How to plot step response of second order system?

omgNot = 1;
zetaNot = 0.6;
H = tf(omgNot^2,[1, 2*zetaNot*omgNot, omgNot^2]);
stepplot(H)
I am using the code above to plot the step response of a second order system, but I am getting the follwoing error
Invalid default value for property 'InputName_' in class
'DynamicSystem':
Attempt to execute SCRIPT strings as a function:
I would really appreciate your help. Thank you.

7 件のコメント

madhan ravi
madhan ravi 2019 年 2 月 4 日
Upload the script file that you are executing.
theblueeyeswhitedragon
theblueeyeswhitedragon 2019 年 2 月 4 日
The code above is all I have in the script
madhan ravi
madhan ravi 2019 年 2 月 4 日
編集済み: madhan ravi 2019 年 2 月 4 日
Might happen you have a script file named as a function. What shows up? when you type the below in command window post the results:
which tf -all
which stepplot -all
theblueeyeswhitedragon
theblueeyeswhitedragon 2019 年 2 月 4 日
>> which tf -all
which stepplot -all
C:\Program Files\MATLAB\R2017b\toolbox\control\ctrlmodels\@tf\tf.m % tf constructor
C:\Program Files\MATLAB\R2017b\toolbox\control\ctrlmodels\@DynamicSystem\tf.m % DynamicSystem method
C:\Program Files\MATLAB\R2017b\toolbox\dsp\filterdesign\@mfilt\tf.m % mfilt method
C:\Program Files\MATLAB\R2017b\toolbox\shared\controllib\engine\@StaticModel\tf.m % StaticModel method
C:\Program Files\MATLAB\R2017b\toolbox\signal\signal\@dfilt\tf.m % dfilt method
C:\Program Files\MATLAB\R2017b\toolbox\shared\controllib\engine\@DynamicSystem\stepplot.m % DynamicSystem method
madhan ravi
madhan ravi 2019 年 2 月 4 日
Not certain where exactly the problem lies but you seem to be missing:
/Applications/MATLAB_R2018b.app/toolbox/ident/ident/@idParametric/tf.m % idParametric method
theblueeyeswhitedragon
theblueeyeswhitedragon 2019 年 2 月 4 日
How do i fix this problem? Is there a way to add the .m file to this folder?
madhan ravi
madhan ravi 2019 年 2 月 4 日
The best option is to contact mathworks support team by clicking the Contact Us button on the top right corner if this page. And finally post the solution (the reason) provided by them as an answer and accept it so it might be helpful for others.

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

回答 (4 件)

Hiroumi Mita
Hiroumi Mita 2019 年 2 月 4 日

0 投票

Do you have any MATLAB workspace variables pre-defined and the name is such as,'tf' ,'sterpplot', or ' DynamicSystem'?
Needless to say, double defined same name of pre-defined functions and workspace variable is prohibited.
The reason is priority of workscape name and functionname depends on the prioirty of MATLAB path.
If you have 'tf' where is in MATLAB workspace variable , this is the highest priority.
Second, if you have 'tf' function or other famous name's function you personally programed in current directory which name is same as functions as provided by toolboxes , the function located in current directory has higher priority than Toolboxes.
Please check above.
In my environment , your scriput runs normally.

1 件のコメント

madhan ravi
madhan ravi 2019 年 2 月 4 日
It would have been crystal clear when typing
which ... -all
as the OP has posted the results of it , neither it is a variable or a custom made function/script. Possible reason could be that the OP has made some changes in the default script file.

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

Vikas Panit
Vikas Panit 2021 年 8 月 18 日

0 投票

You can use the MATLAB pre-defined variables of Control Systems Toolbox to solve the following problem. If you dont have Control Systems toolbox download from here - https://in.mathworks.com/products/control.html
Here is the code you can use to find step response of second order system and command window output:
wn= input('frequency')
zeta= input('damping factor')
k= input('constant')
num= [k*wn^2]
deno= [1 2*zeta*wn wn^2]
g= tf(num, deno)
t= feedback(g,1)
step(t, 'r')
Martial Mezatio
Martial Mezatio 2022 年 2 月 1 日

0 投票

clear all
close all
s=tf(s);
g=1/2*s+1);
step_g/s)
Afshan.N.
Afshan.N. 2023 年 7 月 13 日

0 投票

wn= input('frequency') zeta= input('damping factor') k= input('constant') num= [k*wn^2] deno= [1 2*zeta*wn wn^2] g= tf(num, deno) t= feedback(g,1) step(t, 'r')

カテゴリ

製品

リリース

R2017b

質問済み:

2019 年 2 月 4 日

回答済み:

2023 年 7 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by