No BSD License  

Highlights from
synthesis

from synthesis by Evgeny Veremey
Solves SISO mean-square optimal control design problems: A(p)x = B(p)u + f(t)

re=analys(A,B,N,T)
function re=analys(A,B,N,T)
% This program plots the graph of relationship between <u^2> and <x^2>
%for varying values of m.The system is A(p)x=B(p)u+f(t) and performance
%criterion is J=m^2<x^2>+<u^2>. 
flag=1;
if length(A)==1 
   handle=warndlg('It''s not funny!','Warning.');flag=0;
else
   if length(A)<length(B) 
      handle=warndlg('deg(B)>deg(A):It''s unreal!','Warning.');flag=0; 
      else
rootsofA=mysort(roots(A));
if length(B)>1 
rb=roots(B);
k=length(rb);
for i=1:length(rootsofA) 
   ra=rootsofA(i);
   for j=1:k 
      if rb(j)==ra 
         if real(ra)>=0 
            handle=warndlg('System is Nonstabilized.','Warning.');flag=0;
         end;
      end;  
   end;      
end;
else k=0;
end;   
if length(N)>1
rn=sort(roots(N));
ra=length(rn);
if real(rn(ra))>=0 
   handle=errordlg('Error in N(s).','Error.','replace'); 
   flag=0;
end;
end;
rt=sort(roots(T));
ra=length(rt);
if real(rt(ra))>0 
   handle=errordlg('Error in T(s).','Error','replace') ;
   flag=0;
end;

if k<1 lb=0;
 else  
   rootsofB=mysort(rb);
   if real(rootsofB(k))<0  lb=0;
   else lb=1;
   end;
end;
end;
end;

if flag==1   
if real(rootsofA(length(rootsofA)))<0
   if lb==0
       Umin=[0];
       Xmin=[0];
       Umax=( norm( tf(N,conv(T,B)),2 ) )^2*pi;
       Xmax=( norm( tf(N,conv(T,A)),2 ) )^2*pi;
    else 
       Umin=[0];
       Xmax=( norm( tf(N,conv(T,A)),2 ) )^2*pi;
       [polRightB,polLeftB]=gurnogur(B);
       [Xmin,Umax]=xuminmax(polRightB,polLeftB,A,N,T);
   end
else if lb==0
        Xmin=[0];
        Umax=( norm( tf(N,conv(T,B)) ) )^2*pi;
        [polRightA,polLeftA]=gurnogur(A);
        [Umin,Xmax]=xuminmax(polRightA,polLeftA,B,N,T);
     else 
           [polRightA,polLeftA]=gurnogur(A);
           [polRightB,polLeftB]=gurnogur(B);
           [Xmin,Umax]=xuminmax(polRightB,polLeftB,A,N,T);
           [Umin,Xmax]=xuminmax(polRightA,polLeftA,B,N,T);
      end
end;
XX=zeros(102,1);
UU=zeros(102,1);
XX(1,1)=Xmax;
XX(102,1)=Xmin;
UU(1,1)=Umin;
UU(102,1)=Umax;
lgmm=-10;
set(findobj(gcbf,'Tag','StaticText8'),'Visible','on');
for i=2:101
   [w1,w2,XX(i,1),UU(i,1)]=alg2(A,B,N,T,exp(lgmm));
   lgmm=lgmm+0.2;
   st=num2str(i-1);
   set(findobj(gcbf,'Tag','StaticText8'),'String',strcat(st,'% done'));
end;
set(findobj(gcbf,'Tag','StaticText8'),'Visible','off');
 hold off;
plot(UU,XX);
hold on;
plot(UU(102),XX(102),'o');
text(UU(102),XX(102),' m=inf');
plot(UU(1),XX(1),'o');
text(UU(1),XX(1),' m=0');
grid on;
xlabel('<u^2>');
ylabel('<x^2>');
re=1;
else re=0;
   end;
 

Contact us at files@mathworks.com