plotting bode and step on the same graph
Show older comments
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
João Felipe Gueiros Batista da Silva
on 7 Jan 2023
Did you manage to find a solution?
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.
Answers (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
Categories
Find more on Classical Control Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


