How to plot multiple output responses of transfer functions in the same figure?

 채택된 답변

Yusuf Suer Erdem
Yusuf Suer Erdem 2021년 11월 29일
편집: Yusuf Suer Erdem 2021년 11월 29일
Try these codes below please;
clc; clear; close all;
numerator = 1;
denominator = [1,1,3,1];
sys = tf(numerator,denominator);
yyaxis left
plot(step(sys));
yyaxis right
plot(impulse(sys));

추가 답변 (2개)

Anish Mitra
Anish Mitra 2025년 11월 14일
이동: Sam Chak 2025년 11월 14일
If the use of yyaxis is not needed, then the stepplot command can be directly used to generate the step response. Beginning in R2024b, the chart object created has a set of properties that can be modified to customize the style.
numerator = 1;
denominator = [1,1,3,1];
sys = tf(numerator,denominator);
figure(1)
sp = stepplot(sys);
Responses can be added by using hold on or the addResponse function.
denominator2 = [1 1 4 1];
sys2 = tf(numerator,denominator2);
hold on;
stepplot(sys2);
legend('sys1', 'sys2')
or
% denominator2 = [1 1 4 1];
% sys2 = tf(numerator,denominator2);
figure(2)
sp = stepplot(sys);
addResponse(sp,sys2);
legend('sys1', 'sys2')
See list of all linear analysis plots.
Adem
Adem 2024년 2월 7일
clc; clear; close all;
numerator = 1;
denominator = [1,1,3,1];
sys = tf(numerator,denominator);
yyaxis left
plot(step(sys));
yyaxis right
plot(impulse(sys));

카테고리

도움말 센터File Exchange에서 System Identification Toolbox에 대해 자세히 알아보기

질문:

2021년 11월 29일

이동:

2025년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by