function for saving arrays as header files
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 22 Sep 2015 19:34:35 +0000 (19:34 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 22 Sep 2015 19:34:35 +0000 (19:34 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2348 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/newamp_fbf.m
codec2-dev/octave/save_array_c_header.m [new file with mode: 0644]

index 119a5814639759942ae84a144fc9651a3257165d..891c6541a9ab01c0f06f7e344ed648d923f24794 100644 (file)
@@ -115,14 +115,13 @@ function newamp_fbf(samname, f)
     figure(3)
     subplot(211)
     plot(Sdb)
-    hold on;
-    plot(20*log10(abs(Aw(1:256))),'g')
-    hold off;
+    title('Mag (dB)');
     subplot(212)
     plot(phase(1:256))
     hold on;
-    plot(angle(Aw(1:256)),'g')
+    plot(angle(Aw(1:256))+0.5,'g')
     hold off;
+    title('Phase (rads)');
     figure(4)
     plot(s)
 
diff --git a/codec2-dev/octave/save_array_c_header.m b/codec2-dev/octave/save_array_c_header.m
new file mode 100644 (file)
index 0000000..0a6800d
--- /dev/null
@@ -0,0 +1,14 @@
+% save_array_c_header.m
+%
+% David Rowe Sep 2015
+
+function save_array_c_header(array, array_name, filename)
+  f=fopen(filename,"wt");
+  fprintf(f,"/* Generated by save_array_c_header.m Octave function */\n\n");
+  fprintf(f,"const int %s[]={\n", array_name);
+  for m=1:length(array)-1
+    fprintf(f,"  %f,\n",array(m));
+  endfor
+  fprintf(f,"  %f\n};\n",array(length(array)));
+  fclose(f);
+endfunction