diff options
Diffstat (limited to 'macros/isminphase.sci')
-rw-r--r-- | macros/isminphase.sci | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/macros/isminphase.sci b/macros/isminphase.sci index ccd2754..9a76e0f 100644 --- a/macros/isminphase.sci +++ b/macros/isminphase.sci @@ -1,3 +1,22 @@ +//isminphase Determine whether filter is minimum phase or not + +// Description : It determines whether the given system function is minimum phase system or not . Minimum phase system means all zeros of transfer function will be inside the unit circle in z-plane , also poles mustbe within unit circle for stability and causality + +//Syntax +//flag = isminphase(b,a) +//flag = isminphase(sos) +//flag = isminphase(...,tol) +// b and a are the vectors containing numerator and denumerator coefficients respectively +//tol, tolerance is used to determine when two numbers are close enough to be considered equal. + +//Example : of minimum phase system +//flag = isminphase([1 -0.3 0.02],1) + +//Output +// flag = +// +// 1. + //Author: Parthasarathi Panda //parthasarathipanda314@gmail.com function ismin=isminphase(varargin) @@ -55,18 +74,18 @@ function ismin=isminphase(varargin) gc=gcd([poly_a,poly_b]); [r,den]=pdiv(poly_b,gc); [r,num]=pdiv(poly_a,gc); - maxpole=min(abs(roots(den))); - maxzero=min(abs(roots(num))); - if length(a)==1 then - if length(b)==1 then + maxpole=max(abs(roots(den))); + maxzero=max(abs(roots(num))); + if length(b)==1 then + if length(a)==1 then ismin=1; - elseif maxzero>1 then - ismin=1; - else + elseif maxzero<1 then ismin=0; + else + ismin=1; end elseif maxpole>1 then - if length(b)==1 then + if length(a)==1 then ismin=1; elseif maxzero>1 then ismin=1; |