help-octave
[Top][All Lists]
Advanced

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

Re: need help regarding phase margin calculation


From: Lukas Reichlin
Subject: Re: need help regarding phase margin calculation
Date: Tue, 16 Feb 2010 11:41:20 +0100

On 16.02.2010, at 06:58, <address@hidden> wrote:

>  
>  
> 
> Dear Sir,
>  
> I am new user for octave GNU. I don't know how to calculate phase margin 
> using extrapolation for a bode plot with if or for loop. previously i done 
> this in MATLAB and loop code is
> for i=1:1:30
> if((mag(i)>1) & (mag(i+1)<1))
> j=i
> y2=mag(i);
> y1=mag (i+1)
> x2=w(i)
> x1=w(i+1)
> end
> end
> how this will do in octave. could you please help me out?
>  
> Thanks & Regards,
> Kanta
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Hi Kanta

We don't want to reinvent the wheel, do we? ;-) There is already a command that 
does exactly what you want: margin. Therefore, you may want to give a try to my 
new control package (experimental):
http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/control-oo.tar.gz?view=tar
There you can do the following (Matlab compatible):

[gamma, phi, w_gamma, w_phi] = margin (sys)

where phi is the phase margin and w_phi the associated frequency. You can get 
more information by typing
help margin
once you installed my package.

hth
Lukas

PS: Install the package by typing
pkg install control*
inside your working directory. Be sure to remove the "legacy" control package 
before

Warning: Because of a bug in Octave 3.2.x, system sys changes sampling time 
after the first call of a time response function (lsim, step, impulse, 
initial). This bug is fixed in current development sources for Octave 3.4.


reply via email to

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