time domain specifications calculations from graph
조회 수: 4 (최근 30일)
이전 댓글 표시
from the step() inbuilt function to plot second order system response, form the graph how to mark various time domain specifications in MATLAB2022b.
댓글 수: 0
답변 (1개)
Epsilon
2024년 8월 22일
편집: Epsilon
2024년 8월 22일
Hi Pranav,
The step() function can be used to plot the second order system response. Here is a documentation link to Step response plot of dynamic system; step response data - MATLAB step (mathworks.com).
Also the stepinfo() function can be used to compute step-response characteristics which can then be used to update the plot of the step response. Here is a documentation link to Rise time, settling time, and other step-response characteristics - MATLAB stepinfo (mathworks.com).
Here is an attached exemplar code for your reference, hope it helps!
% Define system parameters
wn = 5; % Natural frequency (rad/s)
zeta = 0.5; % Damping ratio
% Define an exemplar transfer function
num = [wn^2]; % Numerator coefficients
den = [1, 2*zeta*wn, wn^2]; % Denominator coefficients
sys = tf(num, den);
% Plot the step response
step(sys);
hold on;
% Calculate time-domain specifications
info = stepinfo(sys);
% Mark Rise Time
plot([info.RiseTime info.RiseTime], [0 1], 'r--', 'DisplayName', 'Rise Time');
% Mark Peak Time
plot([info.PeakTime info.PeakTime], [0 info.Peak], 'g--', 'DisplayName', 'Peak Time');
% Mark Settling Time
plot([info.SettlingTime info.SettlingTime], [0 1], 'b--', 'DisplayName', 'Settling Time');
% Mark Overshoot
plot(info.PeakTime, info.Peak, 'ro', 'DisplayName', 'Overshoot');
% Add labels and legend
xlabel('Time (seconds)');
ylabel('Response');
title('Step Response with Time Domain Specifications');
legend('show');
hold off;
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!