function [re,im]=nyquist_ol(B,A,R,S,Ts);
//function [re,im]=nyquist_ol(B,A,R,S,Ts);
//plots a nyquist plot (frequency response in complex plain of open loop) 
//of a discret system consisted of the model B/A connected with a controller 
//R/S. The diagram is as follows:
//
// r     -----  u  -----   y
// --O--| 1/S |---| B/A |----
//  -|   -----     -----   | 
//   |   -----             |
//   ---|  R  |-------------
//       -----
//
//inputs:
//B=b0 + b1z +...+ bmz^m ... model numerator  
//A=a0 + a1z +...+ anz^n ... model denominator 
//R=r0 + r1z +...+ rkz^k ... controller numerator 
//S=s0 + s1z +...+ slz^l ... controller denominator
//Ts ... sampling time of the system
//otputs:
//re ... vector of real parts of the frequency response
//im ... vector of imaginary parts of the frequency response
//
//written by:  H. Prochazka, I.D. Landau
//7th june 2002

num=B*R;
den=A*S;
sys=syslin(Ts,num,den);
nyquist(sys);
[f,rep]=repfreq(sys,-1/(2*Ts),1/(2*Ts));
re=real(rep);
im=imag(rep);
