⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stable_indirect_wrc.m

📁 一个用MATLAB编写的优化控制工具箱
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This program implements the stable indirect controller% for the aircraft wing rock example (model/problem used% in the chapter, not the homework problem).%% Kevin Passino% Version: 12/17/99%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Initialize variablesclear% Define plant parameters:global a1 a2 a3 a4 a5 b tau beta0 beta1 thetama1=-0.0148927;a2=0.0415424;a3=0.01668756;a4=-0.06578382;a5=0.08578836;b=1.5;tau=1/15;beta0=10;beta1=40;thetam=(beta1-beta0)/2;% The number of parameters of the approximatorsglobal pbeta R palphapbeta=1;  % Simply use a constant to estimate the beta termR=9; % Number of rulespalpha=R*4; % 4 arises since there are 4 terms in the consequents (one is the affine term)% Controller	n=3;  % Since in the plant we are computing y^(3) but really the state we                          % need is x=[x(1), x(2), x(3)]^T% We will use a TS fuzzy system but with only x(1) and x(2) as inputs% to the premise and all of x as an input to the consequent - with an affine termglobal cc=0*ones(n-1,1); % To force to be a column%gr=-1:0.5:1;gr=-2:2:2;[Cx,Cy]=meshgrid(gr,gr);l=0;for i=1:length(gr)      for j=1:length(gr)			  l=l+1;			  c(:,l)=[Cx(i,j); Cy(i,j)];       endendglobal sigma%sigma=0.5;sigma=2;% Next, parameters to compute the nu signalglobal k1 k0 gammak1=20;k0=100;gamma=2;% Sliding mode termglobal Walpha WbetaWalpha=0.01;  % A guessWbeta=0;  % The most it could be off by ideally% Define matrix for calculation of reference signalsglobal AmAm=0*eye(4);% Set adaptation gainsglobal etaalpha etabetaetaalpha=2;etabeta=2;% Define simulation parameters:Tfinal=2; % Units are secondsTspan=[0 Tfinal];% Define initial conditions:y0=[.4 0 0];   % For the plantym0=[0 0 0 0];  % For reference inputthetaalpha0=0.00*(-0.5*ones(1,palpha)+rand(1,palpha)); % Just pick small random valuesthetabeta0=10;  % Simply use a constant for estimating beta[t,z]=ode45('sindwingrockc',Tspan,[y0 ym0 thetaalpha0 thetabeta0]);%[t,z]=ode15s('sindwingrock',Tspan,[y0 ym0 thetaalpha0 thetabeta0]);y=z(:,1:3);   % The plant states, and the y^(3)ym=z(:,4:7);  % The reference model signalsthetaalpha=z(:,length(y0)+length(ym0)+1:length(y0)+length(ym0)+palpha); % The parametersthetabeta=z(:,length(y0)+length(ym0)+palpha+1);% Plot the plant signalsfigure(1)clfsubplot(211)plot(t,y(:,1),'k-',t,ym(:,1),'k--')title('Roll angle y(t) (solid) and y_m(t) (dashed)')subplot(212)plot(t,y(:,3),'k-')xlabel('Time, sec.')ylabel('\delta_A')title('Aileron input')xlabel('Time (sec)')figure(2)clfplot(t,y(:,2),'k-',t,ym(:,2),'k--')title('Derivative of y and y_m')xlabel('Time (sec)')figure(3)clfplot(t,thetabeta)title('\theta_\beta')xlabel('Time (sec)')figure(4)clfplot(t,thetaalpha)title('\theta_\alpha components')xlabel('Time (sec)')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End of program%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -