calculate SNR and watch a binary file

Markus Feldmann feldmann_markus at gmx.de
Thu Mar 26 14:24:49 CDT 2009


Francesco Potorti` schrieb:

> Have you applied my suggestions above?
> 
Yes. :-)
But i got further information,
http://gnuradio.org/trac/wiki/Octave
and there exists an ready to use script, which i post further below.

i tried out and found some further documentation. But i am not sure.
As i assume, the IQ Signals should be a pair of 32 bit so i get 64 bit.

Here are the script to get the complex data out of the binary file and
save it to a vector:
###############################################################
function v = read_complex_binary (filename, count)

   %% usage: read_complex_binary (filename, [count])
   %%
   %%  open filename and return the contents as a column vector,
   %%  treating them as 32 bit complex numbers
   %%

   m = nargchk (1,2,nargin);
   if (m)
     usage (m);
   end

   if (nargin < 2)
     count = Inf;
   end

   f = fopen (filename, 'rb');
   if (f < 0)
     v = 0;
   else
     t = fread (f, [2, count], 'float');
     fclose (f);
     v = t(1,:) + t(2,:)*i;
     [r, c] = size (v);
     v = reshape (v, c, r);
   end
###############################################################
Leave the count parameter empty to save all data into the vector !

Then you have to use this function in octave and plot the data:
c=read_complex_binary('captire.dat')
plot([real(c), imag(c)])

I upload binary files. The first is with a sin signal:
http://rapidshare.com/files/213866747/usrp_output_64bit_complex_only_sin_signal.dat.html

and another one without any test signal, but only noise:
http://rapidshare.com/files/213867606/usrp_output_64bit_complex_only_noise.dat.html

I could plot both vectors, but it doesn't look like my
spectrum graphic,
http://img257.imageshack.us/img257/8017/nochstrender.jpg

I can't find any peak in the octave plot. Maybe the resolution is
not ok.

Maybe this are only the bits that are plotted and i hvae to collect them
first to 32bit pieces ???

Any hints ?

Regards Markus



More information about the Help-octave mailing list