calculate/pich up x-value from step function
2 views (last 30 days)
Show older comments
How I can easiest calculate/pick up x value for r63 and r98 prosent av full scale?
clc; clear all; close all;
% 1 order step respons
Gain=0.999*5;
np = tf([5*0.999], [0.000999, 1])
t = linspace(0, 0.1, 1000);
r63= 5*Gain*0.632;% 63prosent of final value
r98=5*Gain*0.98; % 98 prosent of final value
figure(1)
step(np,'k')
hold on
% 63 and 98 % of full scale
yline( r63,'r-',' 63%', 'LabelHorizontalAlignment','left'); hold on
yline( r98,'r-','98%', 'LabelHorizontalAlignment','left'); hold on
xlim([0, 0.01])
ylim([0.7, 5.5])
grid on
hold off
1 Comment
Oguz Kaan Hancioglu
on 21 Feb 2023
You can use stepinfo command to find time response of the given system. https://www.mathworks.com/help/ident/ref/lti.stepinfo.html
Answers (1)
Sam Chak
on 21 Feb 2023
Hi @Olga Rakvag
% 1st-order step response
Gain = 0.999*5;
np = tf(Gain, [0.000999, 1])
r63 = Gain*0.632 % 63 percent of the final value
r98 = Gain*0.98 % 98 percent of the final value
figure(1)
t = linspace(0, 0.1, 1001);
y = step(np, t); % generate the output values for y
plot(t, y) % make a plot of the step response
% step(np,'k') % or put at this line also can
hold on
% 63 and 98 % of full scale
yline(r63, 'r-', ' 63%', 'LabelHorizontalAlignment', 'left');
yline(r98, 'r-', ' 98%', 'LabelHorizontalAlignment', 'left');
xlim([0, 0.01])
ylim([0, 5.5])
grid on
hold off
% Time it takes to go from 0 to r63
idx1 = find(y > 0.99*r63 & y < 1.01*r63)
y(idx1) % y value closest to r63 = 3.1568
T63 = t(idx1) % around 0.001 sec
% Time it takes to go from 0 to r98
idx2 = find(y > 0.999*r98 & y < 1.001*r98)
y(idx2) % y value closest to r98 = 4.8951
T98 = t(idx2) % around 0.039 sec
Make that you understand before using stepinfo()
stepinfo(np)
0 Comments
See Also
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!