bugGNU Octave - Bugs: bug #41464, freqz plot differs from matlab


bug #41464: freqz plot differs from matlab

Submitted by:  None
Submitted on:  Wed Feb 5 14:05:14 2014  
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: Mike Miller <mtmiller>
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.0
Operating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Thu Feb 13 05:09:30 2014, comment #8:

Fixed on the stable branch with this change:


This will be part of the 3.8.1 stable point release.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Tue Feb 11 13:53:23 2014, comment #7:

Thanks for confirming. I'm working on some changes to make freqz more visually compatible with Matlab. Should have this fixed later today on the stable branch for the next point release.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Tue Feb 11 13:12:16 2014, comment #6:

When I got the error message, I pasted the freqz line into a session that I was using for work. It must have gotten broken somehow, because it works perfectly in a fresh session. The label does indeed say "Frequency (Hz)". Sorry about the confusion!

Mon Feb 10 17:25:27 2014, comment #5:

Maybe you can just go ahead and assume that when the FS argument is given, every calculation and label switches over to using Hertz rather than radians. That way we can move forward. This certainly seems like an easy bug to fix.

Rik <rik5>
Project Administrator
Mon Feb 10 14:33:31 2014, comment #4:

I just get a bunch of errors. Sorry I don't have time to look into it right now, probably it's a minor issue that prevents it from working.

Error using angle (line 6)
Not enough input arguments.

Error in extract_phase>unwrap_phase (line 43)

Error in extract_phase (line 12)
phi = unwrap_phase(h,upn_or_w,iswholerange);

Error in phasez (line 99)
[phi,w] = extract_phase(h,upn_or_w,iswholerange,upfactor,w,addpoint);

Error in freqz (line 123)
phi = phasez(b,a,varargin{:});

Mon Feb 10 14:26:01 2014, comment #3:

Hmm, are you sure about that? Can you please try the following

The x-axis should go from 0 to 4000.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Mon Feb 10 10:26:42 2014, comment #2:

The optional fs parameter does not affect the axis at all. It still says normalized frequency and the numbers are in range 0..1.

Wed Feb 5 16:23:07 2014, comment #1:

Confirmed, judging by the example plot here:


This is something I've run into before but not gotten around to yet. I'd recommend going even further to make the appearance closer to what users may expect: ditch the legend, labels on x and y axes for both plots.

Can someone with access to Matlab check whether the x axis label says "Normalized Frequency (rad)" vs "Frequency (Hz)" depending on whether the optional "fs" argument is given to freqz?

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Wed Feb 5 14:05:14 2014, original submission:

freqz plot has two magnitude plots that zooms in on "interesting areas" in octave while matlab has one plot with the full magnitude.

diff was made against 3.6.4 but the problem remains in latest version

--- C:\Program Files\Octave-3.6.4\share\octave\3.6.4\m\signal\freqz_plot.m 2013-05-28 20:20:18.000000000 +0200
+++ freqz_plot.m 2013-08-13 09:51:33.093494000 +0200
@@ -40,23 +40,13 @@
phase = unwrap (arg (h));
maxmag = max (mag);

- subplot (3, 1, 1);
+ subplot (2, 1, 1);
plot (w, mag);
grid ("on");
- legend ("Pass band (dB)");
- axis ([w(1), w(n), maxmag-3, maxmag], "labely");
+ legend ("Magnitude (dB)");
+ axis ("autoy", "labely");

- subplot (3, 1, 2);
- plot (w, mag);
- grid ("on");
- legend ("Stop band (dB)");
- if (maxmag - min (mag) > 100)
- axis ([w(1), w(n), maxmag-100, maxmag], "labely");
- else
- axis ("autoy", "labely");
- endif
- subplot (3, 1, 3);
+ subplot (2, 1, 2);
plot (w, phase360/(2pi));
grid ("on");
legend ("Phase (degrees)");



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Feb 13 05:09:30 2014mtmillerStatusConfirmed=>Fixed
    Wed Feb 5 16:23:07 2014mtmillerItem GroupNone=>Matlab Compatibility
      Assigned toNone=>mtmiller

    Back to the top

    Powered by Savane 3.1-cleanup1