how to obtain peak time

28 views (last 30 days)
Ahmad Jamal
Ahmad Jamal on 2 Apr 2022
Commented: Star Strider on 3 Apr 2022
I have a motor response oscillating data in two columns, column 1 is time and column 2 is the response in volts. I want to develop a simple MATLAB routine to plot the data (which I have done) and find the oscillation characteristic (Peak time, overshoot %, rise time, and settling time) in the same MATLAB routine (I obtained this one too).
My problem is that I want to see the same parameters in the plot too. The system characteristic option box does not appear in the plot. what statement can I add to the existing routine to have this feature enabled. The small routine I have made is as follows:
close all
clear all
clc
fid=fopen('Exp_4_No_1_Ki_10_for_Parameters.txt','rt');
C=textscan(fid,'%f%f');
% t=fid(:,1);
% R=fid(:,1);
fclose(fid);
sys=cell2mat(C);
t=sys(:,1);
response=sys(:,2);
plot(sys(:,1:1),sys(:,2:2))
title('Response curve')
%step(sys)
% stepinfo(response,t,2.045)
S=stepinfo(response,t,2.045)
Thank you for the assistance.

Accepted Answer

Star Strider
Star Strider on 2 Apr 2022
I am not certain what the problem is with what you want to do, however the text function could be a solution.
  1 Comment
Star Strider
Star Strider on 3 Apr 2022
None of the plots automatically display those.
Try something like this —
sys=tf([1 5 5],[1 1.65 5 6.5 2]);
figure
step(sys)
S=stepinfo(sys);
Sfn = fieldnames(S);
Sc = struct2cell(S);
StrS = cellfun(@(x,y)compose('%s %.4f',x,y),Sfn,Sc);
text(30,1, StrS)
figure
step(sys)
text(20,1,Sfn)
text(35,1,Sc)
.

Sign in to comment.

More Answers (1)

Ahmad Jamal
Ahmad Jamal on 3 Apr 2022
Actually the following small code produces a plot of the transfer function. if you right click inside the plot area, a new window appears that allows you to turn on the parameters such as the rise time, settling time, etc. and you can see these parameters on the plot.
close all
clear all
clc
sys=tf([1 5 5],[1 1.65 5 6.5 2]);
step(sys)
S=stepinfo(sys)
whereas my plot when right clicked doesn't show me the window to turn on these parameters. is there something diferent or how can I have those parameters enabled in my plot.
thank you for your help.

Community Treasure Hunt

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

Start Hunting!