Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Help with RootLocusPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130677] Help with RootLocusPlot
  • From: "Eduardo M. A. M. Mendes" <emammendes at gmail.com>
  • Date: Wed, 1 May 2013 21:39:50 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Hello

I am using Manipulate to see how the gain k affects the response of a system.   Two graphics are shown:  OuputResponse and RootLocusPlot.

Below you will find the piece of code I am working with.


copenloop[k_,z_]:=TransferFunctionModel[(k(s+z))/(s(s+4)(s+6)),s];copenloop[k,z]

cclosedloop[k_,z_]:=SystemsModelFeedbackConnect[copenloop[k,z]];cclosedloop[k,z]

Clear[crlPlt,croots,crespPlt];


crlPlt[k_,z_]:=RootLocusPlot[Evaluate@copenloop[k,z],{k,0,250},PlotLabel->Style[Evaluate@copenloop[k,z] ,16],PlotRange-> Automatic,ImageSize-> {250,300},PlotStyle-> Thickness[0.02]];


croots[s_,loc_,z_]:=Quiet@Solve[copenloop[loc,z][[1,1,1,1]]/copenloop[loc,z][[1,2]]==-1,s];


crespPlt[tmax_,k_,z_]:=OutputResponse[cclosedloop[k,z],UnitStep[t],{t,0,tmax}];


Manipulate[GraphicsRow[{Show[Plot[Evaluate[crespPlt[100,loc,z]],{t,0,6},PlotRange->{All,{0,1.5}},AxesOrigin-> {0,0},GridLines->Automatic,GridLinesStyle-> Dashed,AspectRatio->Full,AxesLabel->{Style["t",Italic,14],Style["y(t)",Italic,14]},PlotLabel->Style["Step Response and Root Locus",16],PlotStyle-> Thickness[0.01],ImageSize-> {250,250}]],

Show[Evaluate@crlPlt[loc,z],Graphics[{Gray,AbsolutePointSize[10],Tooltip[Point[#],"k=="<>ToString[loc]]&/@({Re[s],Im[s]}/.croots[s,loc,z])}]]}],
Style["Root Locus" ,18,Bold],"",Delimiter,{{loc,k1,"Gain (k)"},0,100,1,Appearance->"Labeled"},Delimiter,{{z,z2,"Zero (z)"},0,20,1,Appearance->"Labeled"},SaveDefinitions-> True]

The second panel does not show what I need.  What am I doing wrong?   I feel that I am missing something ....

Many thanks

Ed




  • Prev by Date: Re: Intersection points of two contour plots
  • Next by Date: Re: Function with optional default argument cannot cache
  • Previous by thread: Time, location, and activity plotting
  • Next by thread: Re: Plot with axes exchanged