%
%  EVALSV.M: Preparing singular value plots 
%
w = logspace(-3,3,100);
%
disp(' ')
disp(' - - Computing the SV Bode plot of the plant open loop - -');
svg = sigma(ag,bg,cg,dg,1,w);
svg = 20*log10(svg);
%
disp(' ')
disp(' - - Computing the SV Bode plot of Ty1u1 - -');
svtt = sigma(acl,bcl,ccl,dcl,1,w); 
%[svtt,temp] = sort(-svtt); svtt = -svtt;
svtt = 20*log10(svtt);
%
svw1i = bode(1/Gam*w1(2,:),w1(1,:),w); svw1i = 20*log10(svw1i);
svw3i = bode(w3(2,:),w3(1,:),w); svw3i = 20*log10(svw3i);
%
[al,bl,cl,dl] = series(acp,bcp,ccp,dcp,ag,bg,cg,dg);
%
[as,bs,cs,ds] = feedbk(al,bl,cl,dl,1);
disp(' ')
disp(' - - Computing the SV Bode plot of S - - ')
svs = sigma(as,bs,cs,ds,1,w);
%[svs,temp] = sort(-svs); svs = -svs;     
svs = 20*log10(svs);      
%
[at,bt,ct,dt] = feedbk(al,bl,cl,dl,2);
disp(' ')
disp(' - - Computing the SV Bode plot of I-S - - ')
svt = sigma(at,bt,ct,dt,1,w);
%[svt,temp] = sort(-svt); svt = -svt;
svt = 20*log10(svt);
%
[ali,bli,cli,dli] = series(ag,bg,cg,dg,acp,bcp,ccp,dcp);
disp(' ');
disp(' - - Computing the SV Bode plot of T at plant input - -');
svti = sigma(ali,bli,cli,dli,4,w); 
svti = -20*log10(svti);
%
%disp('                 << Plot variable names >>');
%disp('---------------------------------------------------------------');
%disp(' w ------ freqeuncy (rad/sec)');
%disp(' svs ---- singular values of S(jw) (sensitivity)');
%disp(' svt ---- singular values of I-S(jw) (complementary sensitivity)');
%disp(' svtt --- singular values of the cost function (Ty1u1(jw))');
%disp(' svw1i --- singular values of 1/W1(jw) weighting function');
%disp(' svw3i --- singular values of 1/W3(jw) weighting function');
%disp('---------------------------------------------------------------');
%
% -------- End of EVALSV.M --- RYC/MGS %
