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 = 6;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 2;
sizes.NumInputs = 9;%% 123is command 4-9 is state feedback
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 0;
sys = simsizes(sizes);
x0 = [0,0,0,0,0,0];
str = [];
ts = [];
function sys=mdlDerivatives(t,x,u)
epc =10;
x1=u(4);dx1=u(5);
y1=u(6);dy1=u(7);
th=u(8);dth=u(9);
xc=x1-epc*sin(th);
yc=y1+epc*cos(th);
%(8)
p1=xc;
dp1=dx1-epc*cos(th)*dth;
p2=yc;
dp2=dy1-epc*sin(th)*dth;
p3=tan(th);
dp3=1/(cos(th))^2*dth;
q1=p1;q2=dp1;
q3=p2;q4=dp2;
q5=p3;q6=dp3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xd=u(1);
dxd=1;
yd=u(2);
dyd=cos(t);
thd=u(3);
dthd=0;
xcd=xd-epc*sin(thd);
ycd=yd+epc*cos(thd);
p1d = xcd;
dp1d=dxd-epc*cos(thd)*dthd;
p2d = ycd;
dp2d =dyd-epc*sin(thd)*dthd;
p3d = tan(thd);
dp3d=1/(cos(thd))^2*dthd;
q3d=p2d;
q4d=dp2d;
q5d=p3d;
sys(1)=q4*q5; %integral of y4y5
sys(2)=x(3); %Second integral of y3
sys(3)=q3; %integral of y3
sys(4)=q4d*q5d;
sys(5)=x(6);
sys(6)=q3d;
function sys=mdlOutputs(t,x,u)
epc =10;
xd=u(1);dxd=1;ddxd=0;
yd=u(2);dyd=cos(t);ddyd=-sin(t);
thd=u(3);dthd=0;ddthd=0;
x1=u(4);dx1=u(5);
y1=u(6);dy1=u(7);
th=u(8);dth=u(9);
xc=x1-epc*sin(th);
yc=y1+epc*cos(th);
%(12)
p1=xc;dp1=dx1-epc*cos(th)*dth;
p2=yc;dp2=dy1-epc*sin(th)*dth;
p3=tan(th);dp3=(sec(th))^2*dth;
q1=p1;q2=dp1;
q3=p2;q4=dp2;
q5=p3;q6=dp3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xcd=xd-epc*sin(thd);
ycd=yd+epc*cos(thd);
%(12)
p1d = xcd;dp1d=dxd-epc*cos(thd)*dthd;
ddp1d=ddxd-epc*(-sin(thd)*dthd+cos(thd)*ddthd);
p2d = ycd;dp2d = dyd-epc*sin(thd)*dthd;
ddp2d=ddyd-epc*(cos(thd)*dthd+sin(thd)*ddthd);
p3d = tan(thd);dp3d=1/(cos(thd))^2*dthd;
ddp3d=2*sec(thd)*sec(thd)*tan(thd)*dthd+sec(thd)^2*ddthd;
q1d=p1d;
q3d=p2d;q4d=dp2d;
q5d=p3d;q6d=dp3d;
dq1d=dp1d;
dq2d=ddp1d;
dq3d=dp2d;dq4d=ddp2d;
dq5d=dp3d;dq6d=ddp3d;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z1 = [q1+x(1);x(2)];
z2 = [q2+q4*q5;x(3)]; %dz1=z2
z3 = [q3;q5];
z4 = [q4;q6]; %dz3=z4
z4d = [q4d;q6d]; %dz3=z4
z1d=[q1d+x(4);x(5)];
dz1d=[dq1d+q4d*q5d;x(6)]; %dz1=z2
dz2d=[dq2d+q4d*dq5d+dq4d*q5d;q3d];
dz3d=[dq3d;dq5d];
dz4d=[dq4d;dq6d];
g=9.8;
f1=[q4*q6-g*q5;q3];
f1d =[q4d*q6d-g*q5d;q3d];
f2=[-g;0];
b=[-1,0;0,1];
f1_z3 = [0,-g;1,0];
f1_z3d=f1_z3;
ddz1d=f1d; %ddz1=dz2=f1
dddz1d=f1_z3d*z4d; %dddz1=ddz2=df1
ddddz1d=f1_z3d*dz4d;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c1=27;c2=27;c3=9;
ueq=-inv(f1_z3*b)*(c1*z2-c1*dz1d +c2*f1-c2*ddz1d+c3*f1_z3*z4-c3*dddz1d +f1_z3*f2-ddddz1d);
e1=z1-z1d;
e2=z2-dz1d;
e3=f1-ddz1d;
e4=f1_z3*z4-dddz1d;
s=c1*e1+c2*e2+c3*e3+e4;
M=0.10;
nmn=0.10;
S=2;
if S==1
sat=sign(s);
elseif S==2 %Saturated function
fai=0.1;
if abs(s)<=fai
sat=s/fai;
else
sat=sign(s);
end
end
usw=-inv(f1_z3*b)*(M*sat+nmn*s);
%(17)
h=ueq+usw;
%(10),(11)
v1=h(1)*1/cos(th);
v2=h(2)*(cos(th))^2-2*(dth)^2*tan(th);
%(8)
vm1= (v1-epc*(dth)^2)*sin(th)+epc*v2*cos(th);
vm2=-(v1-epc*(dth)^2)*cos(th)+epc*v2*sin(th)-g;
vm=[vm1;vm2+g];
%(4)
ut=[-sin(th) cos(th);1/epc*cos(th) 1/epc*sin(th)]*vm;
sys(1)=ut(1);
sys(2)=ut(2);
没有合适的资源?快使用搜索试试~ 我知道了~
滑模变结构控制matlab源代码
共346个文件
m:271个
mdl:70个
fis:2个
需积分: 42 66 下载量 30 浏览量
2017-11-05
11:50:49
上传
评论 7
收藏 652KB RAR 举报
温馨提示
滑模变结构控制matlab源代码,欢迎有需要的朋友下载,谢谢
资源推荐
资源详情
资源评论
收起资源包目录
滑模变结构控制matlab源代码 (346个子文件)
smc_fuzz.fis 607B
fsmc.fis 486B
chap5_6ctrl.m 4KB
chap8_10ctrl.m 3KB
chap8_7ctrl.m 3KB
chap9_4ctrl.m 3KB
chap9_7ctrl.m 3KB
chap8_5ctrl.m 2KB
chap10_3ctrl.m 2KB
chap9_4plant.m 2KB
chap8_9ctrl.m 2KB
chap8_6ctrl.m 2KB
chap11_5ctrl.m 2KB
chap10_8.m 2KB
chap7_2.m 2KB
chap9_5ctrl.m 2KB
chap8_4ctrl.m 2KB
chap8_8ctrl.m 2KB
chap9_3ctrl.m 2KB
chap10_5.m 2KB
chap11_6adapt.m 2KB
chap10_7.m 1KB
chap9_2ctrl.m 1KB
chap11_1ctrl.m 1KB
chap10_6.m 1KB
chap5_1ctrl.m 1KB
chap11_2ctrl.m 1KB
chap11_6ctrl.m 1KB
chap9_6ctrl.m 1KB
chap5_2.m 1KB
chap5_8obv.m 1KB
chap5_5ctrl.m 1KB
chap6_4ctrl.m 1KB
chap9_1ctrl.m 1KB
chap2_7.m 1KB
chap5_4ctrl.m 1KB
chap5_10obv.m 1KB
chap10_2.m 1KB
chap7_13.m 1KB
chap11_6plant.m 1KB
chap8_10plant.m 1KB
chap11_3ctrl.m 1KB
chap5_10ctrl.m 1KB
chap11_1plant.m 1KB
chap5_11ctrl.m 1KB
chap5_3ctrl.m 1KB
chap8_10plot.m 1KB
chap5_7ctrl.m 1KB
chap4_3ctrl.m 1KB
chap4_2ctrl.m 1KB
chap3_2ctrl.m 1KB
chap4_4ctrl.m 1KB
chap11_5plot.m 1KB
chap5_10plant.m 1KB
chap5_5plant.m 1KB
chap11_2plant.m 1KB
chap9_7plant.m 1KB
chap4_3plant.m 1KB
chap5_9ctrl.m 1KB
chap8_3ctrl.m 1KB
chap2_5ctrl.m 1KB
chap10_4.m 1KB
chap2_4ctrl.m 1KB
chap11_6plot.m 1KB
chap11_5plant.m 1KB
chap5_9obv.m 1KB
chap6_3ctrl.m 1KB
chap5_11plant.m 1KB
chap9_4plot.m 1KB
chap11_4ctrl.m 1KB
chap7_14ctrl.m 1KB
chap5_1plant.m 1KB
chap7_10plot.m 1KB
chap8_3fuzz.m 1KB
chap4_2plant.m 1KB
chap7_8eso.m 1KB
chap3_4plant.m 1KB
chap8_5plant.m 1KB
chap4_5rbf.m 1KB
chap6_1plant.m 1KB
chap6_7ctrl.m 1KB
chap4_1adapt.m 1KB
chap9_2plant.m 1KB
chap9_3plant.m 1KB
chap3_3plant.m 1KB
chap8_7plant.m 1KB
chap9_6plant.m 1KB
chap2_5dis.m 1KB
chap8_2fuzz.m 1024B
chap4_2adapt.m 1014B
chap8_3plant.m 1013B
chap7_4ctrl.m 1009B
chap5_7plant.m 997B
chap6_4plant.m 996B
chap11_3plant.m 991B
chap7_12obv.m 990B
chap7_11obv.m 990B
chap11_2plot.m 984B
chap5_1lmi.m 983B
chap5_6plant.m 969B
共 346 条
- 1
- 2
- 3
- 4
资源评论
automan_huyaoge
- 粉丝: 483
- 资源: 94
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于C51带字库LCD12864(ST7920)的keil工程源码,只支持8位并口通讯(不支持串口),可显示中文.zip
- 基于SI4463射频模块433MD-SMA无线模块软硬件技术资料及(SI4463)IC技术资料文档.zip
- (GPS+北斗+GSM)HLK-GS2503模块软硬件开发资料包硬件参考设计(原理图PCB)+技术文档资料.zip
- 基于BERT+Biaffine结构的关系抽取模型源码+文档说明.zip
- 利用c语言编写的冒泡排序代码
- 基于Ansoft-HFSS知识总结hfss中文教程HFSS培训教材等技术资料合集(50个).zip
- 基于Python+OpenCV的材料缺陷检测程序项目源码课程设计.zip
- 基于c语言实现的二叉树代码
- pip利用清华镜像源下载matplotlib代码
- Python的pyqt5写的图书管理系统期末大作业源码带文档设计.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功