freqz issue

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

freqz issue

Laurent HAAS - F6FVY
Hi

I'm trying to experience basic signal processing with Octave, while the
original article has been written for Matlab

http://aaronscher.com/wireless_com_SDR/RTL_SDR_AM_spectrum_demod.html

I'm actually facing this issue :

In the "Plot the spectrum" section,

freqz(y(1:5000),1,[-4E6:.01E6:4E6],2.5E6);

keeps the spectrum totally blank, and returns this error :

 >> freqz(y(1:5000),1,[-4E6:.01E6:4E6],2.5E6);
error: __plt2vv__: vector lengths must match
error: called from
     __plt__>__plt2vv__ at line 482 column 5
     __plt__>__plt2__ at line 242 column 14
     __plt__ at line 107 column 18
     plot at line 223 column 10
     freqz_plot at line 55 column 3
     freqz at line 194 column 5
 >>

I'm running Octave 5.1.0 under Win7-32 bit

What am I missing ?

Thanks and regards

--

I never lose. I either win or learn - Nelson Mandela


Reply | Threaded
Open this post in threaded view
|

Re: freqz issue

siko1056
On 1/6/20 10:12 PM, Laurent HAAS - F6FVY wrote:

> Hi
>
> I'm trying to experience basic signal processing with Octave, while the
> original article has been written for Matlab
>
> http://aaronscher.com/wireless_com_SDR/RTL_SDR_AM_spectrum_demod.html
>
> I'm actually facing this issue :
>
> In the "Plot the spectrum" section,
>
> freqz(y(1:5000),1,[-4E6:.01E6:4E6],2.5E6);
>
> keeps the spectrum totally blank, and returns this error :
>
>>> freqz(y(1:5000),1,[-4E6:.01E6:4E6],2.5E6);
> error: __plt2vv__: vector lengths must match
> error: called from
>     __plt__>__plt2vv__ at line 482 column 5
>     __plt__>__plt2__ at line 242 column 14
>     __plt__ at line 107 column 18
>     plot at line 223 column 10
>     freqz_plot at line 55 column 3
>     freqz at line 194 column 5
>>>
>
> I'm running Octave 5.1.0 under Win7-32 bit
>
> What am I missing ?
>
> Thanks and regards
>


I am a bit lazy to go deep into your issue (not my domain), but a
minimal working example would be

  y = ones (1, 5000);
  freqz(y(1:5000),1,[-4E6:.01E6:4E6],2.5E6);

Thus what is the `y` you are trying to work with?

  [m,n] = size (y)
  min (y)
  max (y)

Which call of `freqz()` [1,2] would you like to use?

HTH,
Kai

[1] https://octave.org/doc/v5.1.0/XREFfreqz.html
[2] https://www.mathworks.com/help/signal/ref/freqz.html


Reply | Threaded
Open this post in threaded view
|

Re: freqz issue

Laurent HAAS - F6FVY
Hi Kai et al.

Thanks for your reply.

Le 10/01/2020 à 03:09, Kai Torben Ohlhus a écrit :

> I am a bit lazy to go deep into your issue (not my domain), but a
> minimal working example would be
>
>    y = ones (1, 5000);
>    freqz(y(1:5000),1,[-4E6:.01E6:4E6],2.5E6);
>
> Thus what is the `y` you are trying to work with?

y are I/Q sample (complex) from a radio receiver.

And your basic example, opened my eyes.

Apparently, at least when plotting spectrum, Octave freqz can *only* use
real data (not complex), while Matlab freqz can handle complex data, and
plot correct spectrum (not symetrical around DC).

Being a total newbie in Octave, I can't say if it has to be considered
as a known limitation of Octave, or a bug concerning "Matlab
compatibility ? I couln't find any bug report about that.

In all cases, the spectrum output can't be plot identically to Matlab
this way.

Thanks again and rgds

Laurent

--

I never lose. I either win or learn - Nelson Mandela


Reply | Threaded
Open this post in threaded view
|

Re: freqz issue

Mike Miller-4
On Fri, Jan 10, 2020 at 15:26:20 +0100, Laurent HAAS - F6FVY wrote:

> Apparently, at least when plotting spectrum, Octave freqz can *only* use
> real data (not complex), while Matlab freqz can handle complex data, and
> plot correct spectrum (not symetrical around DC).
>
> Being a total newbie in Octave, I can't say if it has to be considered as a
> known limitation of Octave, or a bug concerning "Matlab compatibility ? I
> couln't find any bug report about that.
>
> In all cases, the spectrum output can't be plot identically to Matlab this
> way.
Yes, this looks like a bug to me, can you please file a bug report at
https://savannah.gnu.org/bugs/?func=additem&group=octave

Specifically, freqz can handle both real and complex inputs, but there
is an off by one error when plotting the two-sided spectrum and the user
passes a specific range of frequences in the third argument.

Thanks,

--
mike



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: freqz issue

Laurent HAAS - F6FVY
Hi Mike et al.

Le 10/01/2020 à 18:15, Mike Miller a écrit :

> Yes, this looks like a bug to me, can you please file a bug report at
> https://savannah.gnu.org/bugs/?func=additem&group=octave

Done

https://savannah.gnu.org/bugs/?57576

> Specifically, freqz can handle both real and complex inputs, but there
> is an off by one error when plotting the two-sided spectrum and the user
> passes a specific range of frequences in the third argument.
Thanks for tracking this bug down more precisely. It will probably help
for a fix.

Rgds

Laurent

--

I never lose. I either win or learn - Nelson Mandela