MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: bode diagram

On May 11, 2005, at 5:26 AM, GaLoIs wrote:

> hi, like plotting simple bode diagrams of systems. could you give  
> me some
> information about it? i can do it with another program, but i'd  
> like to see
> how mathematica works
> thank you


Here's some simple code for making a Bode plot:

gain[p_, q_, \[Omega]_] := q/Sqrt[p^2*\[Omega]^2 + (q - \[Omega]^2)^2];

\[Phi][p_, q_, \[Omega]_] :=
   ArcCos[(q - \[Omega]^2)/Sqrt[p^2*\[Omega]^2 + (q - \[Omega]^2)^2]];

gainplot[p_, q_]:= Plot[20 Log[10, gain[p,q,10^x]], {x,-1,1},  
     AxesLabel -> {"\!\(log\_10\)\[Omega]", "Gain (dB)"}];

angleplot[p_, q_] := Plot[\[Phi][p, q, 10^x]/Degree, {x,-1,1},  
     AxesLabel -> {"\!\(log\_10\)\[Omega]", "Phase Angle (deg)"},
     Ticks -> {Automatic, 30 Range[1, 6]}];

<< "Graphics`Graphics`"

BodePlot[p_, q_] := DisplayTogetherArray[{gainplot[p, q], angleplot 
[p, q]},
    PlotLabel->"Bode Plot  ( p="<>ToString[p]<>", q="<>ToString[q] 
<>" )",
    Frame-> True, ImageSize -> 500];

BodePlot[.5, 5]



Selwyn Hollis

  • Prev by Date: Re: Crossing of 3D functions
  • Next by Date: Re: Crossing of 3D functions
  • Previous by thread: bode diagram
  • Next by thread: Re: bode diagram