time domain specifications calculations from graph

조회 수: 4 (최근 30일)
Pranav Illinda
Pranav Illinda 2023년 1월 23일
편집: Epsilon 2024년 8월 22일
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