Make a bode plot without bode()?

65 ビュー (過去 30 日間)
Kebels3
Kebels3 2020 年 3 月 3 日
編集済み: Rik 2021 年 3 月 4 日
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 件のコメント
Star Strider
Star Strider 2020 年 3 月 3 日
Take the fft of the impulse output (get the time vector as well), then calculate the magnitude and phase and plot them.
Rik
Rik 2021 年 3 月 4 日
Editing away your question is extremely rude. I will restore it from the Google cache.

サインインしてコメントする。

回答 (1 件)

Robert U
Robert U 2020 年 3 月 4 日
編集済み: Robert U 2020 年 3 月 4 日
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
  1 件のコメント
Kris Hoffman
Kris Hoffman 2020 年 10 月 13 日
Perfect!

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by