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

 
 

bug #41464: freqz plot differs from matlab

Submitted by:  None
Submitted on:  Wed 05 Feb 2014 02:05:14 PM UTC  
 
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 13 Feb 2014 05:09:30 AM UTC, comment #8:

Fixed on the stable branch with this change:

http://hg.savannah.gnu.org/hgweb/octave/rev/694e8f0b3862

This will be part of the 3.8.1 stable point release.

Mike Miller <mtmiller>
Project MemberIn charge of this item.
Tue 11 Feb 2014 01:53:23 PM UTC, 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 MemberIn charge of this item.
Tue 11 Feb 2014 01:12:16 PM UTC, 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!

Anonymous
Mon 10 Feb 2014 05:25:27 PM UTC, 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 10 Feb 2014 02:33:31 PM UTC, 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)
phi=unwrap(angle(h));

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{:});

Anonymous
Mon 10 Feb 2014 02:26:01 PM UTC, 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 MemberIn charge of this item.
Mon 10 Feb 2014 10:26:42 AM UTC, 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.

Anonymous
Wed 05 Feb 2014 04:23:07 PM UTC, comment #1:

Confirmed, judging by the example plot here:

http://www.mathworks.com/help/signal/ref/freqz.html

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 MemberIn charge of this item.
Wed 05 Feb 2014 02:05:14 PM UTC, 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)");

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

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 13 Feb 2014 05:09:30 AM UTCmtmillerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 05 Feb 2014 04:23:07 PM UTCmtmillerItem GroupNone=>Matlab Compatibility
      StatusNone=>Confirmed
      Assigned toNone=>mtmiller

    Back to the top


    Powered by Savane 3.1-cleanup