www.pudn.com > Fuzzy---simulink.rar > Sregulation.m, change:2009-05-20,size:557b


function[sys,x0]=Sregulation(t,x,u,flag) 
global Ke Kec Ku; 
Ke=1;Kec=1;Ku=16; 
if flag==0 
    sys=[0,0,3,2,0,1]; 
    x0=[]; 
elseif flag==3 
     if abs(u(1))>0.2|abs(u(2))>0.1 
         sys(1)=0.4*Ke*u(1); 
         sys(2)=0.04*Kec*u(2); 
         sys(3)=Ku+14; 
     elseif  abs(u(1))>0.1|abs(u(2))>0.04 
         sys(1)=0.5*Ke*u(1); 
         sys(2)=0.27*Kec*u(2); 
         sys(3)=Ku+12; 
         else 
         sys(1)=0.8*Ke*u(1); 
         sys(2)=0.6*Kec*u(2); 
         sys(3)=Ku; 
         end 
 else      
         sys=[]; 
     end