Matlab

Solo disponible en BuenasTareas
  • Páginas : 2 (378 palabras )
  • Descarga(s) : 0
  • Publicado : 23 de mayo de 2011
Leer documento completo
Vista previa del texto
Rules for Making Bode Plots
Term
Constant: K Real Pole:
1 s +1 ω0
• • •

Magnitude
20·log10(|K|)


Phase
K>0: 0° K n=[1 11 10]; >> d=[1 10 10000 0]; >> sys=tf(n,d) Transfer function: s^2+ 11 s + 10 ---------------------s^3 + 10 s^2 + 10000 s >> damp(d) Eigenvalue 0.00e+000 -5.00e+000 + 9.99e+001i -5.00e+000 - 9.99e+001i >> damp(n) Eigenvalue -1.00e+000 -1.00e+001 >> >> >> >> >> %Anumerator polynomial (arbitrary) %Denominator polynomial (arbitrary)

%Find roots of den. If complex, show zeta, wn. Damping Freq. (rad/s) -1.00e+000 0.00e+000 5.00e-002 1.00e+002 5.00e-002 1.00e+002%Repeat for numerator Freq. (rad/s) 1.00e+000 1.00e+001

Damping 1.00e+000 1.00e+000

%Use Matlab to find frequency response (hard way). w=logspace(-2,4); %omega goes from 0.01 to 10000;fr=freqresp(sys,w); subplot(211); semilogx(w,20*log10(abs(fr(:)))); title('Mag response, dB') subplot(212); semilogx(w,angle(fr(:))*180/pi); title('Phase resp, degrees')

>> %Let Matlab do all of the work >>bode(sys) >> %Find Freq Resp at one freq. %Hard way >> fr=polyval(n,j*10)./polyval(d,j*10) fr = 0.0011 + 0.0010i >> %Find Freq Resp at one freq. >> fr=freqresp(sys,10) fr = 0.0011 + 0.0009i >>abs(fr) ans = 0.0014 >> angle(fr)*180/pi ans = 38.7107 %Convert to degrees %Easy way

>> %You can even find impulse and step response from transfer function. >> step(sys) >> impulse(sys)

© Copyright2005-2009 Erik Cheever

This page may be freely used for educational purposes. Comments? Questions? Suggestions? Corrections? Erik Cheever Department of Engineering Swarthmore College

>>[n,d]=tfdata(sys,'v') n = 0 1 11 10 d = 1 10 >> [z,p,k]=zpkdata(sys,'v') z = -10 -1 p = 0 -5.0000 +99.8749i -5.0000 -99.8749i k = 1

%Get numerator and denominator.

10000

0

%Get poles and zeros>> %BodePlotGui - Matlab program shows individual terms of Bode Plot. Code at: >> % http://www.swarthmore.edu/NatSci/echeeve1/Ref/LPSA/Bode/BodePlotGui.html >> >> BodePlotGui(sys)

© Copyright...
tracking img