📄 utility_calculatetime.m
字号:
function [y,t] = Utility_CalculateTime(z,p,k,ti,tf,DoWhat)
% Utility_CalculateTime is a subfile of the AnalogFilter GUI collection
%
% James C. Squire, 2002
% Assistant Professor, Virginia Military Institute
% ver 1.0
% Utility_CalculateTime finds the time response of a system
% [y,t] = Utility_CalculateTime(z,p,k,ti,tf,DoWhat)
NSAMPLES = 500;
% create t
ts = (tf-ti)/(NSAMPLES-1);
t=[0:ts:tf]';
% add an extra integrator for step,ramp responses
switch DoWhat
case 'Impulse'
case 'Step'
p = [p; 0];
case 'Ramp'
p = [p; 0; 0];
case 'Parabola'
p = [p; 0; 0; 0];
otherwise
error('Unknown DoWhat switch')
end
% convert from zpk to ss
[a,b,c,d] = Utility_zpk2ss(z,p,k);
% convert from ct to dt
d = c * b;
a = expm(a*ts);
b=a*b;
u = eye(size(t));
x0 = zeros(size(a,1),1); % zero initial state
tt = ltitr(a,b,u,x0);
y = tt * c';
y(1) = y(1) + d;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -