plotting bode and step on the same graph

9 ビュー (過去 30 日間)
Mohammed
Mohammed 2014 年 11 月 14 日
回答済み: Sulaymon Eshkabilov 2023 年 1 月 8 日
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 件のコメント
João Felipe Gueiros Batista da Silva
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 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 1 月 8 日
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

Community Treasure Hunt

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

Start Hunting!

Translated by