Show Step Response Information on Step Response Plot

111 ビュー (過去 30 日間)
MatlabNewbie01232015
MatlabNewbie01232015 2013 年 10 月 12 日
コメント済み: James Richard 2018 年 11 月 22 日
Normally, if I want to display the information of the Step Response (peak, rise time, etc). I click on the plot and select "Characteristics > Peak Response",etc. I intend to design a Gui (very basic one) that the Step Response will automatically show these information at run-time.
step(handles.axes_step,sys, stepinfo(sys)) %I have trouble with the show stepinfo on the plot. If I cannot find a way, I just let it be but I guess there should be a way.

採用された回答

Jonathan LeSage
Jonathan LeSage 2013 年 10 月 14 日
You're on the right track trying to use stepinfo. The stepinfo function returns a structure containing all the common step response metrics. You can directly plot the these results. Here is some example code to get you started:
% Defining an arbitrary system
s = tf('s');
G = 1/(s^2 + 5*s + 2);
% Computing the system step response
[y,t] = step(G);
stepResults = stepinfo(y,t);
% Extract the settling time from the stepinfo structure
tSettle= stepResults.SettlingTime;
% Other step response results of interest can be found by looking in
% the stepResults structure
% Find the first index where time exceeds the settling time
% To further improve this, you could interpolate between the points.
indexSettle = find(t >= tSettle,1,'first');
xSettle = t(indexSettle);
ySettle = y(indexSettle);
% Plot step response
plot(t,y);
grid on;
hold on;
% Plot settling time point
plot(xSettle,ySettle,'ro');
% Plot chart lines to settling point
plot([0 xSettle],[ySettle ySettle],'g-.');
plot([xSettle xSettle],[0 ySettle],'g-.');
hold off;
You could easily repeat this same process for each step response metric of interest. Hope this helps!
  1 件のコメント
MatlabNewbie01232015
MatlabNewbie01232015 2013 年 10 月 15 日
Very nice - I understand the approach - well I still need to learn but the example is very clear and easy to follow.

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

その他の回答 (3 件)

Jeffry
Jeffry 2018 年 11 月 4 日
sys = tf(1,[1 .5]);
h = stepplot(sys);
grid on
% characteristics are those found under h.CharacteristicManager.CharacteristicID
h.showCharacteristic('PeakResponse')
h.showCharacteristic('RiseTime')
  1 件のコメント
James Richard
James Richard 2018 年 11 月 22 日
Go to
[Your Installation Directory]\toolbox\shared\controllib\graphics\@wrfc\@plot\
for more information on this topic
because showCharacteristic.m file is also available there

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


Tekno
Tekno 2018 年 3 月 6 日
dear Jonathan LeSage i have data in figure , how can i get the step info from it? im using matlab 2015 version, please your support.

SimTec
SimTec 2018 年 5 月 24 日
what if we don't have the math model in my case, I saved data to "to Workspace" but got erros

カテゴリ

Help Center および File ExchangeTime and Frequency Domain Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by