Re: Help with a function for plotting zeros and poles
- To: mathgroup at smc.vnet.net
- Subject: [mg132454] Re: Help with a function for plotting zeros and poles
- From: "Eduardo M. A. M. Mendes" <emammendes at gmail.com>
- Date: Wed, 19 Mar 2014 04:24:49 -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
- References: <20140315074645.B9C5E6A3E@smc.vnet.net> <CAEtRDSeEcZc=1WEvQ9jqOw+QVVE7YghNnAKURz0KyrDW1jT1XQ@mail.gmail.com> <93991AEA-C71B-4789-94D0-16E548CD1B29@gmail.com> <CAEtRDSeYHesumE2+LhEGyN_gezUzpZsQKa2oUP292Qi2JfrK9Q@mail.gmail.com>
Many many thanks Ed On Mar 18, 2014, at 6:45 PM, Bob Hanlon <hanlonr357 at gmail.com> wrote: > Sorry about the oversight. > > Clear[zeroPole] > > zeroPole[tf_TransferFunctionModel] := > First /@ > Map[{Re[#], Im[#]} &, > Flatten[Through@{TransferFunctionZeros, TransferFunctionPoles}@tf,= > 1], {3}]; > > tf1 = TransferFunctionModel[(3 (13/8 + s))/(2 (3/2 (13/8 + s) + > s (1 + s) (2 + s) (5 + s))), s]; > > tf2 = TransferFunctionModel[(199 + > 344 s)/(16 (s (1 + s) (2 + s) (5 + s) + 1/16 (199 + 344 s))), = s]; > > N@zeroPole[tf1] > > {{{-1.625, 0.}}, {{-0.5, 0.}, {-0.5, 0.}, {-5.08114, 0.}, {-1.91886, = 0.}}} > > N@zeroPole[tf2] > > {{{-0.578488, 0.}}, {{-0.5, 0.}, {-5.97986, > 0.}, {-0.760068, -1.89264}, {-0.760068, 1.89264}}} > > > Bob Hanlon > > > > On Tue, Mar 18, 2014 at 5:20 PM, Eduardo M. A. M. Mendes = <emammendes at gmail.com> wrote: > Dear Bob > > Many thanks but there is a problem: in the output of the new zeroPole = function there is no distinction between poles and zeros (Please see the = output of the old zeroPole function). > > Again I have no idea how to get this right. Changes on the level of = Flatten won't do. > > Cheers > > Ed > > > On Mar 18, 2014, at 12:18 PM, Bob Hanlon <hanlonr357 at gmail.com> wrote: > >> Clear[zeroPole] >> >> zeroPole[tf_TransferFunctionModel] := >> {Re[#], Im[#]} & /@ >> Flatten[ >> Through@ >> {TransferFunctionZeros, TransferFunctionPoles}@ >> tf]; >> >> tf1 = TransferFunctionModel[ >> (3 (13/8 + s))/(2 (3/2 (13/8 + s) + s (1 + s) (2 + s) (5 + s))), = s]; >> >> tf2 = TransferFunctionModel[ >> (199 + 344 s)/(16 (s (1 + s) (2 + s) (5 + s) + 1/16 (199 + 344 = s))), s]; >> >> N@zeroPole[tf1] >> >> {{-1.625, 0.}, {-0.5, 0.}, {-0.5, 0.}, {-5.08114, 0.}, {-1.91886, = 0.}} >> >> N@zeroPole[tf2] >> >> {{-0.578488, 0.}, {-0.5, 0.}, {-5.97986, >> 0.}, {-0.760068, -1.89264}, {-0.760068, 1.89264}} >> >> >> Bob Hanlon >> >> >> >> On Sat, Mar 15, 2014 at 3:46 AM, Eduardo M. A. M. Mendes = <emammendes at gmail.com> wrote: >> Hello >> >> Sometime ago I found a couple of functions that are used for plotting = the poles and zeros of a transfer function. Here they are: >> >> = xyPoints[values_]:=Module[{xy},xy=Flatten[Replace[values,{Complex[x_,y= _]:>{x,y},x_?NumericQ:>{x,0}},{3}],1];Cases[xy,{_?NumericQ,_?NumericQ},{2}= ] >> ]; >> >> = zeroPole[tf_]:=Module[{zp,zp0},zp0=Through@{TransferFunctionZeros,Tran= sferFunctionPoles}@tf; >> zp=FixedPoint[ReplaceAll[#,{}->{-100}]&,zp0]; >> xyPoints/@zp]; >> >> zeroPole is a modification of the actual plot function (I have only = removed the plot command). >> >> Here are two examples of using the functions >> >> tf1=TransferFunctionModel[(3 (13/8+s))/(2 (3/2 (13/8+s)+s (1+s) = (2+s) (5+s))),s] >> tf2=TransferFunctionModel[(199+344 s)/(16 (s (1+s) (2+s) (5+s)+1/16 = (199+344 s))),s] >> >> N@zeroPole[tf1] >> {{{-1.625,0.}},{{-0.5,0.},{-0.5,0.},{-5.08114,0.},{-1.91886,0.}}} >> >> N@zeroPole[tf2] >> {{{-0.578488,0.}},{{-0.5,0.},{-5.97986,0.},{-0.760068-1.89264 = I,0.},{-0.760068+1.89264 I,0.}}} >> >> The functions does what I expected for the first example, but not for = the second example (the real and imaginary parts of the complex poles = are not dealt with). >> >> Can someone tell me what is wrong? And how to modify xyPoints = (Although I understand what the functions does I am not sure what to = do)? >> >> Many many thanks >> >> Ed >> >> >> > >
- References:
- Help with a function for plotting zeros and poles
- From: "Eduardo M. A. M. Mendes" <emammendes@gmail.com>
- Help with a function for plotting zeros and poles