📄 stablize.m
字号:
function [n,d]=stablize(ty,n,d)
% STABLIZE Stabilize an unstable polynomial
%
% [NS,DS] = STABLIZE(TY,NU,DU) Stabilizes an unstable transfer function
% TY = 's' for a CT HU(s) or TY = 'z' for a DT HU(z)
% NU, DU are the num and den of the unstable transfer function.
% NOTE: An allpass transfer function is used to stabilize HU.
% NS, DS are num and den of the stabilized transfer function HS.
%
% STABLIZE (with no input arguments) invokes the following example:
%
% % Check if H(z) =(z-0.5)/(z*z*z-5z*z+6*z) is unstable and if so,
% % stabilize H(z) to HS(z) and check to see if HS(z) is stable
% >>nu=[1 -0.5];du=[1 -5 6 0]
% >>rts=roots(du) %Check for stability
% >>[ns,ds] = stablize('z',[1 -.5],du)
% >>rts=roots(ds) %Check for stability
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin==0,help stablize,disp('Strike a key to see results of the example')
pause,du=[1 -5 6 0],rts=roots(du),[ns,ds]=stablize('z',[1 -.5],du),
n=roots(ds);return,end
while n(1)==0,n(1)=[];end,
while d(1)==0,d(1)=[];end,
n=n/d(1);d=d/d(1);
r=roots(d);
if ty=='z',i=find(abs(r)>1);else,i=find(real(r)>0);end
if isempty(i),return,end
ru=cplxpair(r(i));r(i)=[];
m=1;
for j=1:length(ru),
if ty=='z',r=[r;conj(1/ru(j))];m=m*ru(j);else,r=[r;-ru(j)];end
end
d=real(poly(r));
if ty=='z',n=n/real(m);end,
if n(1)<0,n=-n;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -