Trying to plot a step response of a given transfer function.

12 ビュー (過去 30 日間)
Jorje German
Jorje German 2020 年 9 月 2 日
コメント済み: Jorje German 2020 年 9 月 2 日
First time posting here so am not sure how exactly to format this or ask this. Simply I am trying to plot the step response of a given transfer function but I keep getting an error stating
"Error using DynamicSystem/step (line 95)
Cannot simulate the time response of improper (non-causal) models.
Error in Lab_1_JGerman (line 99)
[Y, t]=step(sys,10,OPT);"
Here is my code.
m1=1;
m2=1;
c1=1;
c2=1;
k01=0;
k12=100;
k23=10;
s = tf('s')
p1 = [m1*s^2+c1*s+(k01+k12)];
p2 = [m2*s^2+c2*s+(k12+k23)];
p21 = p2/(p1*p2 - k12*k12);
tf1=p2;
sys=tf1;
OPT = stepDataOptions('StepAmplitude', 100);
[Y, t]=step(sys,10,OPT);
plot(t,Y,'r')
hold on
title ('Step Response')
xlabel ('Time (S)')
ylabel("Amplitude)")
grid on

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 9 月 2 日
You probably meant tf1=p21. p2 itself is improper. I assume you know what it means in control theory.
  1 件のコメント
Jorje German
Jorje German 2020 年 9 月 2 日
OMG You are so right. I completly missed it. Yes p2 would not make sense at all. Thank you. Been staring at it for 10 minutes now for a typo.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by