ftp.nice.ch/pub/next/science/physics/COSY_PAK.081.N.s.tar.gz#/COSY_PAK_Main/COSYPAK/chap1.m

This is chap1.m in view mode; [Download] [Up]

(* 
**********************************************************

	        COSY_PAK package chap1.m		

**********************************************************
*)

If [ TrueQ[ $VersionNumber >= 2.0 ],
     Off[ General::spell ];
     Off[ General::spell1 ] ]
     
(*  B E G I N     P A C K A G E  *)
     
BeginPackage["COSYPAK`chap1`","Algebra`ReIm`",
		"SignalProcessing`Support`SigProc`", 
		"SignalProcessing`Analog`LaPlace`",
		"SignalProcessing`Analog`InvLaPlace`",
		"SignalProcessing`Analog`LSolve`"];

ChekAnal::usage = 
"ChekAnal[Transf, s, r, w,showder]:  Checks the analyticity of the transfer function Transf(s) at the point s=r+jw using Cauchy-Reimann conditions.  If `showder=1' (optional) then the derivatives in the computation are shown. ";

PoleZeros::usage = 
"PoleZeros[Transf, s]: Computes finite  poles and zeros of the transfer function Transf . Returns {list of poles, list of zeros}.
";

Begin["`Private`"];

(* Function to check the analyticity of the transfer function *)

ChekAnal[Transf_,s_, r_,w_]:= ChekAnal[Transf,s, r,w,n] ;

ChekAnal[Transf_,s_, r_,w_,showdrv_]:=
Block[{g,greal,gimag,sol,dGrealr,dGrealw,dGimagr,dGimagw,poles},
	r/:Im[r]=0; w/:Im[w]=0; 
	g = ExpandAll[Transf/.s->(r + w I)];
	greal = Simplify[Re[g]]; gimag = Simplify[Im[g]];
	Print[" G(r + w I) = ", greal + I gimag ];
	
	dGrealr = D[greal,r];	(* derive real part of G(r + w I) *) 
	dGrealw = D[greal,w];	
	
	dGimagr = D[gimag,r];	(* derive imaginary part of G(r + w I) *)
	dGimagw = D[gimag,w];
	
	(* Show the derivatives *)
	If[ showdrv==1,
	   Print["The derivatives:"]; 
	   Print["d Re[G(r + w I)] /dr = ",Together[dGrealr] ];	
	   Print["d Re[G(r + w I)] /dw = ",Together[dGrealw] ];
	   Print["d Im[G(r + w I)] /dr = ",Together[dGimagr] ];
	   Print["d Im[G(r + w I)] /dw = ",Together[dGimagw] ] 
	   ];	
	
	(* dGx/dsigma - dGy/domega *)
	If[ (Simplify[dGrealr-dGimagw] ==0) &&
	    (Simplify[dGrealw+dGimagr] ==0),

	  poles = Solve[ Denominator[Simplify[Transf]] ==0, s];  
	  Print["    "];  
	  Print["The Transfer function G(s)= ", Transf," IS an analytical",
	     " function except at the singulality points: ", s/.poles],
	  Print["The Transfer function G(s)= ", Transf," IS NOT an analytical",
	     " function."]
	   ];
	  ];
	  
(* Function list the zeros and poles of the transfer function *)
PoleZeros[Transf_,s_]:=
Block[{gg,gden,gnum},
	gg = Simplify[Transf];
	gden = Denominator[gg] ;
	gnum = Numerator[gg];
	poles = N[Solve[gden ==0, s]]; 
	zeros = N[Solve[gnum ==0, s]];
	Print["The transfer function G(s)= ", Transf];     
	Print["    " ];
	Print["The Poles of G(s) is:",s/.poles];
	Print["    " ];
	Print["The Zeros of G(s) is:",s/.zeros];
	Return[{s/.poles,s/.zeros}]
	];	
End[]
EndPackage[];

(*  E N D     P A C K A G E  *)

If [ TrueQ[ $VersionNumber >= 2.0 ],
     On[ General::spell ];
     On[ General::spell1 ] ]

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.