Step response in iterative calculation

조회 수: 11 (최근 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 CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by