[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: freqz Matlab Incompatibility
From: |
siko1056 |
Subject: |
Re: freqz Matlab Incompatibility |
Date: |
Fri, 18 Aug 2017 16:44:14 -0700 (PDT) |
Thomas D. Dean-2 wrote
> From a matlab example, I get an error - Matlab incompatibility??
>
> http://www.aaronscher.com/wireless_com_SDR/RTL_SDR_AM_spectrum_demod.html
>
> rtl_sdr -f 100500000 -g 40 -s 2500000 -n 25000000 /tmp/FMcapture1.dat
>
> read 100.5 MHz gain 40db 2.5e6 samples/sec 10 seconds output to file
>
> fid = fopen('/tmp/FMcapture1.dat','rb');
> y = fread(fid,'uint8=>double');
> # y is 8-bit i and q data from an rtlsdr,
> y = fread(fid,'uint8=>double');
> y = y-127.5;
> y = y(1:2:end) + i*y(2:2:end);
>
> plot([1:5000], y(1:5000)); ## looks reasonable
>
> freqz(y(1:5000),1,[-4E6:0.01e6:4E6],2.5E6);
> error: __plt2vv__: vector lengths must match
> error: called from
> __plt__>__plt2vv__ at line 489 column 5
> __plt__>__plt2__ at line 248 column 14
> __plt__ at line 113 column 17
> plot at line 223 column 10
> freqz_plot at line 55 column 3
> freqz at line 194 column 5
>
> Tom Dean
Dear Tom,
In your example code and [1] you should avoid the redundant line and
consider using "close (fid);" after "fread".
The problem you are facing is that the vectors to be plotted differ by one
in their length in "freqz". This is due to a change two years ago [2] to fix
bug #43895 [3]. Assuming your calculations are right (I don't have a
background on these), if I comment out that line [2] in "freqz", your
example [1] works for me and the tests of "freqz" still all pass?!
Maybe one should open bug #43895 [3] again for further discussions?
HTH, Kai
[1]:
http://www.aaronscher.com/wireless_com_SDR/RTL_SDR_AM_spectrum_demod.html
[2]: https://hg.savannah.gnu.org/hgweb/octave/rev/8724af455b11#l1.73
[3]: https://savannah.gnu.org/bugs/?43895
--
View this message in context:
http://octave.1599824.n4.nabble.com/freqz-Matlab-Incompatibility-tp4684530p4684531.html
Sent from the Octave - General mailing list archive at Nabble.com.