[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54293] freqz plot differs from MATLAB
From: |
Roland Baudin |
Subject: |
[Octave-bug-tracker] [bug #54293] freqz plot differs from MATLAB |
Date: |
Thu, 12 Jul 2018 09:32:33 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0 |
URL:
<http://savannah.gnu.org/bugs/?54293>
Summary: freqz plot differs from MATLAB
Project: GNU Octave
Submitted by: roland65
Submitted on: Thu 12 Jul 2018 01:32:32 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.2
Operating System: GNU/Linux
_______________________________________________________
Details:
Plotting the frequency response of a filter gives different plots in MATLAB
and in Octave.
To test:
n = [0 : 127];
h = sinc(0.2*(n-128/2)); % Simple test filter
freqz(h, 1, 128, 'whole', 1); % Frequency response on the whole Nyquist
Plots in MATLAB (tested in versions 2014a and 2017b) and in Octave differs
because in this case Octave doubles the number of points used in the FFT,
while MATLAB does not. Thus MATLAB uses a 128 points FFT (as requested) while
Octave uses a 256 points FFT.
The same happens if we plot the frequency response on half the Nyquist band,
like this:
freqz(h, 1, 128, 'half', 1);
I found that commenting out the following lines in freqz.m gives the expected
result:
lines 154 to 157
%~ if (k > n/2 && nargout == 0)
%~ ## Ensure a causal phase response.
%~ n *= 2 .^ ceil (log2 (2*k/n));
%~ endif
lines 168 to 170
%~ if (plot_output)
%~ n += 1;
%~ endif
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54293>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #54293] freqz plot differs from MATLAB,
Roland Baudin <=