Step response in iterative calculation

1 回表示 (過去 30 日間)
Chin Wei Chang
Chin Wei Chang 2017 年 4 月 10 日
I want to plot the step response of this transfer function
Es^2 + As + B / Fs^2 + Cs + D = 90000 / s^2 + 30s + 90000
I use this code,and the output is shown below
H = tf([0 0 90000],[1 30 90000]);
step(H)
In addition,I want to prove this calculation,so I decompose this equation into iterative form
According to this derivation,my code runs thus,and the output is shown below
t=0.001; %period
a=0; %y(n)
b=0; %y(n-1)
c=0; %y(n-2)
A=0;
B=90000;
C=30;
D=90000;
E=0;
F=1;
for n = 0:0.01:0.4,
a = ( heaviside(n)*(E+t*A+t*t*B) + heaviside(n-1)*(-2*E-t*A) + heaviside(n-2)*E + b*(2*F+t*C) -c*F ) / (F+t*C+t*t*D);
c=b;
b=a;
plot(n,a,'*'),
hold on,
end
I try to change period,0.01,0.0001,but the curve is still wrong.
How can I correct this problem?

回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by