Make a bode plot without bode()?

62 Ansichten (letzte 30 Tage)
Kebels3
Kebels3 am 3 Mär. 2020
Bearbeitet: Rik am 4 Mär. 2021
Is there a way to make a bode plot without using the function bode()?
This is the transfer function which i am working with
s = tf('s'); H = (s^3 + 2*s + 5)/(s^4+7*s^3+4*s^2+8*s+12)
  4 Kommentare
Star Strider
Star Strider am 3 Mär. 2020
Take the fft of the impulse output (get the time vector as well), then calculate the magnitude and phase and plot them.
Rik
Rik am 4 Mär. 2021
Editing away your question is extremely rude. I will restore it from the Google cache.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Robert U
Robert U am 4 Mär. 2020
Bearbeitet: Robert U am 4 Mär. 2020
Hi Jeroen von der Klip,
Your task sounds as you want to omit the use of a toolbox. Even though the control system toolbox offers much more extras with bode-command or bodeplot-command you can - of course - plot the transfer function from scratch.
% transfer function as anonymous function
H = @(s)(s.^3 + 2*s + 5)./(s.^4+7*s.^3+4*s.^2+8*s+12);
% frequency vector of domain to be evaluated
omega = 2 * pi * logspace(-3,3,1000);
% magnitude estimation
mag = abs(H(1j*omega));
magDB = 20 * log10(mag);
% phase estimation
phaseDeg = rad2deg( angle(H(1j*omega)) );
% plot results
fh = figure;
ah = subplot(2,1,1,'Parent',fh);
bh = subplot(2,1,2,'Parent',fh);
semilogx(ah,omega/2/pi,magDB)
semilogx(bh,omega/2/pi,phaseDeg)
ah.XGrid = 'on';
ah.YGrid = 'on';
bh.XGrid = 'on';
bh.YGrid = 'on';
ah.XLabel.String = 'frequency [Hz]';
ah.YLabel.String = 'magnitude [dB]';
bh.XLabel.String = 'frequency [Hz]';
bh.YLabel.String = 'phase angle [°]';
ah.Title.String = func2str(H);
Kind regards,
Robert

Community Treasure Hunt

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

Start Hunting!

Translated by