Bode
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am new to Matlab. I need to use the Bode command. When I run my code, I get this error: "Undefined function or method 'bode' for input arguments of type 'double'."
1 Kommentar
Antworten (3)
Oleg Komarov
am 6 Jul. 2011
You may not have the Control System Toolbox. To check that type ver in the command window.
0 Kommentare
Paulo Silva
am 6 Jul. 2011
Besides Oleg suggestion, bode doesn't take double arguments, you must provide one transfer function instead.
%simple example from the bode function documentation
g = tf([1 0.1 7.5],[1 0.12 9 0 0]);
bode(g)
Here's a way to do the bode plot without the control toolbox:
sys=@(s) (s.^2+0.1*s+7.5)./(s.^4+0.12.*s.^3+9*s.^2)
w=1:0.01:40;
amp=10*log10(abs(sys(w*i)));
ang=angle(sys(w*i))*180/pi;
subplot(211)
plot(w,amp)
title(char(sys))
ylabel('Magnitude (DB)')
set(gca,'xscale','log')
subplot(212)
plot(w,ang)
set(gca,'xscale','log')
xlabel('frequency (rad/sec)')
ylabel('phase (deg)')
2 Kommentare
Seng Tak Goh
am 18 Apr. 2019
Hi Paulo,
That was amazing! Do you mind to explain how sys=@(s) actually does the trick?
Many thanks in advance!
Hamed Pouria
am 6 Jul. 2019
It has some promlems.
in line 3 you must write :
amp=20*log10(abs(sys(w*i)));
and also if the number of poles - number of zeros of the system will be bigger than 2 (for example 3) it does not work correctly because of the strict of the function angle(); It will return the phase angles only within the interval [-pi to pi].
Siehe auch
Kategorien
Mehr zu Classical Control Design finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!