plotting bode and step on the same graph

how can i plot a bode plot and a step response of a system on the same graph i used 'hold on' but it came with an error : Plots must be of the same type and size to be superimposed.

댓글 수: 2

Did you manage to find a solution?
Paul
Paul 2023년 1월 7일
Can you post an example picture of what you want to accomplish? Click the Image icon on the Insert menu (next to the Paperclip) to post a picture.

댓글을 달려면 로그인하십시오.

답변 (1개)

There are a couple of issues. Step response is in time domain and Bode is in a frequency response. Therefore they are not compatibe to plot in the same figure.
T = tf(1, [1 1 3]);
step(T, 10) % The system response on the STEP input excitation
bode(T) % Frequency response of the system T
[Y, t]=step(T, 10); % Collect the step response values
plot(t, Y, 'r-', 'linewidth', 2), grid on; title('Step response of the system')
% Frequency response:
f = linspace(0.1, 100, 500);
w = 1i*f;
Y = 1./(w.^2+w+3); % Freq. Response
YR =abs(Y); % Magnitude of the Freq. response
subplot(211)
semilogx(f, 20*log10(YR), 'b'), grid on
subplot(212)
semilogx(f,rad2deg(phase(Y)), 'r'), grid on

질문:

2014년 11월 14일

답변:

2023년 1월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by