help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A question regarding unwrap


From: Doug Stewart
Subject: Re: A question regarding unwrap
Date: Sat, 24 Sep 2005 21:56:12 -0500
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Joe Koski wrote:

on 9/24/05 7:44 PM, Doug Stewart at address@hidden wrote:

Ron Crummett wrote:

Hi -

I have a recent problem with unwrap; I tried plotting the phase of a
transfer function and it jumped halfway through the plot, from -180 to
180.  I tried to unwrap the phase using unwrap and plotted the phase
again, but still had the same jump.  Reading the help on unwrap, it
sounds like it will only really work if the phase is positive (it adds
2*pi).  For me, I have a negative phase, so I need to subtract 2*pi.
Any idea of what the solution could be?  I tried looking at the code
but couldn't make too much sense out of it from my few glances.

Thanks,

Ron Crummett


# fix the phase wrap arownd
ll=length(ph);
[qm iqm]=max(abs(diff(ph)));
if(qm>300)
ph(iqm+1:ll)=ph(iqm+1:ll)-360;
endif

Ron, Doug,

My experience with an alternative (Stearns and David, Signal Processing
Routines in Matlab, which is compatible with Octave) is that the phase
unwrap routines are good for 2*pi+, but then get confused. Maybe a more
robust version of unwrap is in order with an "if" (or some such) to check
the curve continuation.

Joe


This works for High and Low pass filters

My first file was only for Low pass filters.
Doug Stewart
There is probably a better way but this works for me. :-)




# fix the phase wrap around
do
        ll=length(ph);
        [qm iqm]=max((diff(ph)));
        if(qm>300)
         ph(iqm+1:ll)=ph(iqm+1:ll)-360;
        endif
        [qm iqm]=min((diff(ph)));
        if(qm<-300)
        ph(iqm+1:ll)=ph(iqm+1:ll)+360;
        endif
qm
until (abs(qm)<300)





-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]