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.

回答(1 个)

Epsilon
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;

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by