[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
understanding some special script from gnuradio
From: |
Markus Feldmann |
Subject: |
understanding some special script from gnuradio |
Date: |
Mon, 30 Mar 2009 21:32:14 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Hi All,
to understand my other post named <calculate SNR and watch a binary
file>, i want to understand a special octave script first.
This script converts a binary file to a complex float numbers
containing I and Q values.
As i think this binary includes I and Q values and print them outs,
like this:
...
24 + 5i
1 + 24i
-23 + 10i
-19 - 18i
9 - 24i
24 + 1i
5 + 23i
-21 + 13i
-21 - 15i
...
Here comes the script:
################################################################
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
################################################################
Contains each line from the output 2 float numbers ?
Whereas every float is 32 bit ?
So i assume one line includes I + Q ?
Regards Markus
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- understanding some special script from gnuradio,
Markus Feldmann <=