From 554380de440aed0dd2c20c1c394e15c770802b2d Mon Sep 17 00:00:00 2001 From: jcorgan Date: Fri, 28 Sep 2007 21:44:05 +0000 Subject: Merged r6552:6562 from jcorgan/radar into trunk. Updates gr-radar-mono with changes from live field testing. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6563 221aa14e-8319-0410-a670-987f0aec2ac5 --- gr-radar-mono/src/utils/read_avg_sec.m | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gr-radar-mono/src/utils/read_avg_sec.m (limited to 'gr-radar-mono/src/utils/read_avg_sec.m') diff --git a/gr-radar-mono/src/utils/read_avg_sec.m b/gr-radar-mono/src/utils/read_avg_sec.m new file mode 100644 index 000000000..7aa77675d --- /dev/null +++ b/gr-radar-mono/src/utils/read_avg_sec.m @@ -0,0 +1,25 @@ +function avg = read_avg_sec(name, vlen) + + f = fopen(name, "rb"); + s = zeros(1, vlen); + n = 0; + m = 0; + + while (!feof(f)) + t = fread(f, [2, vlen], "float"); + if (size(t) == [2, vlen]) + n = n+1; + c = t(1,:)+t(2,:)*j; + s = s+c; + m = m+1; + if (m == 1000) + avg(n/1000,:) = s/1000; + s = zeros(1, vlen); + m = 0; + endif + endif + endwhile + + fclose(f); + +endfunction -- cgit