imp_inv.m
来自「ipr函数库与仿真实验程序,都是要用到的库函数。」· M 代码 · 共 32 行
M
32 行
function [Gz] = imp_inv(Gs,Ts)
% function [Gz] = imp_inv(Gs,Ts)
% function to convert a continuous-time system into a
% discrete-time system using the impulse invariant
% transform (standard z-transform).
%
% inputs - Gs - Continuous-time LTI system object
% Ts - sampling time
% output - Gz - equivalent discrete-time LTI system object
%%%%%%%%%%%%%%%%%%% imp_inv.m %%%%%%%%%%%%%%%%%%%
% Discrete-Time Control Problems using %
% MATLAB and the Control System Toolbox %
% by J.H. Chow, D.K. Frederick, & N.W. Chbat %
% Brooks/Cole Publishing Company %
% September 2002 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[num,den] = tfdata(Gs);
num = num{1}; den = den{1};
[nrow,ncol] = size(den);
if nrow ~= 1
disp('Functiion imp_inv applies only to single-input systems')
return
end
[r,p,k] = residue(num,den);
pz = exp(p*Ts);
kz = sum(r);
rz = r.*exp(p*Ts);
[numz,denz] = residue(rz,pz,kz);
Gz = tf(Ts*real(numz),real(denz),Ts);
%%%%%%%%%%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?