The faust2octave script, distributed with FAUST, executes shell commands similar to the faust2plot script mentioned above, then executes the generated program to write a matlab input file, and finally loads the file in Octave. The result is typically as if the following commands were typed for the above example:
> faust -a matlabplot.cpp cpgrir.dsp -o cpgrir.cpp > g++ -O3 cpgrir.cpp -o cpgrir > cpgrir -n 600 > cpgrir.m > octave --persist cpgrir.mIn Octave, the variable faustout is a matrix containing the program output. Each output signal is a column of this matrix. In the above example, we have one output signal that is 600 samples long, so the faustout matrix is a column vector.
In Octave, an overlay of all output signals can be plotted by the command
octave:1> plot(faustout);Very often in signal processing we need to see the spectrum of the signal:
octave:1> plot(20*log10(abs(fft(faustout,1024))(1:512,:)));In this example, the signal is zero-padded out to 1024 samples, a Fast Fourier Transform (FFT) is performed, the first 512 samples are selected, the absolute value is taken, followed by conversion to dB, and finally this dB spectral magnitude is plotted. If there are multiple output signals, their dB-magnitude spectra are all plotted overlaid.