function [sys,x0,str,ts] = spacemodel(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts]=mdlInitializeSizes;
case 1,
sys=mdlDerivatives(t,x,u);
case 3,
sys=mdlOutputs(t,x,u);
case {2,4,9}
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts]=mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates = 53;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 3;
sizes.NumInputs = 5;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 0;
sys = simsizes(sizes);
x0 = [0.1*ones(53,1)];
str = [];
ts = [];
function sys=mdlDerivatives(t,x,u)
r1=50;r2=1;r3=10;
xd=0.1*sin(t);
dxd=0.1*cos(t);
ddxd=-0.1*sin(t);
x1=u(2);
x2=u(3);
e=x1-xd;
de=x2-dxd;
k1=3;
s=k1*e+de;
for i=1:1:25
thtaf(i,1)=x(i);
end
for i=1:1:25
thtag(i,1)=x(i+25);
end
for i=1:1:3
thtah(i,1)=x(i+50);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fsd1=0;
fsd2=0;
for l1=1:1:5
gs1=-[(x1+pi/6-(l1-1)*pi/12)/(pi/24)]^2;
u1(l1)=exp(gs1);
end
for l2=1:1:5
gs2=-[(x2+pi/6-(l2-1)*pi/12)/(pi/24)]^2;
u2(l2)=exp(gs2);
end
for l1=1:1:5
for l2=1:1:5
fsu1(5*(l1-1)+l2)=u1(l1)*u2(l2);
fsd1=fsd1+u1(l1)*u2(l2);
end
end
fs1=fsu1/(fsd1+0.001);
fx1=thtaf'*fs1';
gx1=thtag'*fs1'+0.001;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gs3=5*(s+3);
u3(1)=1/(1+exp(gs3));
u3(2)=exp(-s^2);
gs3=5*(s-3);
u3(3)=1/(1+exp(gs3));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fsu2=u3;
for i=1:1:3
fsd2=fsd2+u3(i);
end
fs2=fsu2/(fsd2+0.001);
h1=thtah'*fs2';
ut=1/gx1*(-fx1-k1*de+ddxd-h1);
S1=r1*s*fs1;
S2=r2*s*fs1*ut;
S3=r3*s*fs2;
for i=1:1:25
sys(i)=S1(i);
end
for j=26:1:50
sys(j)=S2(j-25);
end
for j=51:1:53
sys(j)=S3(j-50);
end
function sys=mdlOutputs(t,x,u)
xd=0.1*sin(t);
dxd=0.1*cos(t);
ddxd=-0.1*sin(t);
x1=u(2);
x2=u(3);
e=x1-xd;
de=x2-dxd;
k1=3;
s=k1*e+de;
for i=1:1:25
thtaf(i,1)=x(i);
end
for i=1:1:25
thtag(i,1)=x(i+25);
end
for i=1:1:3
thtah(i,1)=x(i+50);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fsd1=0;
fsd2=0;
for l1=1:1:5
gs1=-[(x1+pi/6-(l1-1)*pi/12)/(pi/24)]^2;
u1(l1)=exp(gs1);
end
for l2=1:1:5
gs2=-[(x2+pi/6-(l2-1)*pi/12)/(pi/24)]^2;
u2(l2)=exp(gs2);
end
for l1=1:1:5
for l2=1:1:5
fsu1(5*(l1-1)+l2)=u1(l1)*u2(l2);
fsd1=fsd1+u1(l1)*u2(l2);
end
end
fs1=fsu1/(fsd1+0.001);
fx1=thtaf'*fs1';
gx1=thtag'*fs1'+0.001;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gs3=5*(s+3);
u3(1)=1/(1+exp(gs3));
u3(2)=exp(-s^2);
gs3=5*(s-3);
u3(3)=1/(1+exp(gs3));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fsu2=u3;
for i=1:1:3
fsd2=fsd2+u3(i);
end
fs2=fsu2/(fsd2+0.001);
h1=thtah'*fs2';
ut=1/gx1*(-fx1-k1*de+ddxd-h1);
sys(1)=ut;
sys(2)=fx1;
sys(3)=gx1;
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
滑模变结构控制MATLAB仿真(第3版):基本理论与设计方法 仿真程序 (357个子文件)
smc_fuzz.fis 607B
fsmc.fis 572B
chap8_7ctrl.m 3KB
chap8_5ctrl.m 2KB
chap10_3ctrl.m 2KB
chap8_9ctrl.m 2KB
chap8_6ctrl.m 2KB
chap10_8.m 2KB
chap7_2.m 2KB
chap9_4ctrl.m 2KB
chap8_4ctrl.m 2KB
chap8_8ctrl.m 2KB
chap9_3ctrl.m 2KB
chap10_5.m 2KB
chap10_7.m 1KB
chap9_2ctrl.m 1KB
chap10_6.m 1KB
chap11_7ctrl.m 1KB
chap11_6ctrl.m 1KB
chap11_10ctrl.m 1KB
chap11_8.m 1KB
chap9_5ctrl.m 1KB
chap12_1ctrl.m 1KB
chap2_8.m 1KB
chap12_2ctrl.m 1KB
chap9_1ctrl.m 1KB
chap10_2.m 1KB
chap11_4ctrl.m 1KB
chap5_6plot.m 1KB
chap12_4ctrl.m 1KB
chap4_3ctrl.m 1KB
chap4_2ctrl.m 1KB
chap3_2ctrl.m 1KB
chap4_3plant.m 1KB
chap7_9kobv.m 1KB
chap8_3ctrl.m 1KB
chap2_5ctrl.m 1KB
chap2_4ctrl.m 1KB
chap6_3ctrl.m 1KB
chap9_6rbf.m 1KB
chap10_4.m 1KB
chap11_7plant.m 1KB
chap7_8plot.m 1KB
chap7_9plot.m 1KB
chap8_3fuzz.m 1KB
chap4_2plant.m 1KB
chap7_6eso.m 1KB
chap3_4plant.m 1KB
chap8_5plant.m 1KB
chap6_1plant.m 1KB
chap4_1adapt.m 1KB
chap9_2plant.m 1KB
chap9_3plant.m 1KB
chap6_6ctrl.m 1KB
chap3_3plant.m 1KB
chap8_7plant.m 1KB
chap9_5plant.m 1KB
chap8_2fuzz.m 1024B
chap4_2adapt.m 1014B
chap8_3plant.m 1013B
chap5_2ctrl.m 1009B
chap5_6obv.m 990B
chap5_5obv.m 990B
chap11_3ctrl.m 981B
chap3_7ctrl.m 968B
chap3_4ctrl.m 968B
chap11_6plant.m 949B
chap5_4ctrl.m 948B
chap12_3ctrl.m 939B
chap8_2ctrl.m 921B
chap3_1ctrl2.m 916B
chap11_5plant.m 908B
chap2_2testctrl.m 897B
chap9_4plant.m 897B
chap2_4plant.m 896B
chap11_4plant.m 889B
chap8_2plant.m 889B
chap4_1ctrl.m 886B
chap7_1ctrl.m 878B
chap8_9plant.m 877B
chap8_6plant.m 872B
chap5_7obv.m 871B
chap12_2plant.m 871B
chap12_4plant.m 871B
chap10_1.m 870B
chap6_2ctrl.m 868B
chap6_5ctrl.m 865B
chap7_9ctrl.m 862B
chap7_8ctrl.m 862B
chap9_6ctrl.m 854B
chap11_2plant.m 850B
chap7_7eso.m 845B
chap2_6ctrl.m 843B
chap2_3ctrl.m 842B
chap6_1ctrl.m 833B
chap7_3obv.m 829B
chap9_6plant.m 805B
chap11_9plant.m 804B
chap11_10plant.m 804B
chap7_8td.m 804B
共 357 条
- 1
- 2
- 3
- 4
资源评论
TOOMsky
- 粉丝: 2
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功