plotting bode and step on the same graph

13 views (last 30 days)
Mohammed
Mohammed on 14 Nov 2014
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 Comments
Paul
Paul on 7 Jan 2023
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.

Sign in to comment.

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 8 Jan 2023
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!