function [sys,x0,str,ts] = MIMO_Tong_s(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
global nmn1 nmn2 Fai
nmn1=5;nmn2=5;
Fai=[nmn1 0;0 nmn2];
sizes = simsizes;
sizes.NumContStates = 4*5^4;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 4;
sizes.NumInputs = 10;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 0;
sys = simsizes(sizes);
x0 = [0.1*ones(4*5^4,1)];
str = [];
ts = [];
function sys=mdlDerivatives(t,x,u)
global nmn1 nmn2 Fai
qd1=u(1);
qd2=u(2);
dqd1=0.3*cos(t);
dqd2=0.3*cos(t);
dqd=[dqd1 dqd2]';
ddqd1=-0.3*sin(t);
ddqd2=-0.3*sin(t);
ddqd=[ddqd1 ddqd2]';
q1=u(3);dq1=u(4);
q2=u(5);dq2=u(6);
ddq1=u(9);ddq2=u(10);
for l1=1:1:5
gs1=-[(q1+pi/6-(l1-1)*pi/12)/(pi/24)]^2;
u1(l1)=exp(gs1);
end
for l2=1:1:5
gs2=-[(dq1+pi/6-(l2-1)*pi/12)/(pi/24)]^2;
u2(l2)=exp(gs2);
end
for l3=1:1:5
gs3=-[(q2+pi/6-(l3-1)*pi/12)/(pi/24)]^2;
u3(l3)=exp(gs3);
end
for l4=1:1:5
gs4=-[(dq2+pi/6-(l4-1)*pi/12)/(pi/24)]^2;
u4(l4)=exp(gs4);
end
for l5=1:1:5
gs5=-[(ddq1+pi/6-(l5-1)*pi/12)/(pi/24)]^2;
u5(l5)=exp(gs5);
end
for l6=1:1:5
gs6=-[(ddq2+pi/6-(l6-1)*pi/12)/(pi/24)]^2;
u6(l6)=exp(gs6);
end
fsd=0;
fsu=zeros(5^4,1);
for l1=1:5
for l2=1:5
for l3=1:5
for l4=1:5
fsu(5^3*(l1-1)+5^2*(l2-1)+5*(l3-1)+l4)=u1(l1)*u2(l2)*u3(l3)*u4(l4);
fsd=fsd+u1(l1)*u2(l2)*u3(l3)*u4(l4);
end
end
end
end
fs=fsu/(fsd+0.001);
fsd1=0;
fsu1=zeros(5^4,1);
for l1=1:5
for l2=1:5
for l5=1:5
for l6=1:5
fsu1(5^3*(l1-1)+5^2*(l2-1)+5*(l5-1)+l6)=u1(l1)*u2(l2)*u5(l5)*u6(l6);
fsd1=fsd1+u1(l1)*u2(l2)*u5(l5)*u6(l6);
end
end
end
end
fs1=fsu1/(fsd1+0.001);
e1=q1-qd1;
e2=q2-qd2;
e=[e1 e2]';
de1=dq1-dqd1;
de2=dq2-dqd2;
de=[de1 de2]';
s=de+Fai*e;
Gama11=0.01;Gama12=0.01;
Gama21=0.01;Gama22=0.01;
S11=-1/Gama11*s(1)*fs;
S12=-1/Gama12*s(2)*fs;
S21=-1/Gama21*s(1)*fs1;
S22=-1/Gama22*s(2)*fs1;
for i=1:1:5^4
sys(i)=S11(i);
end
for j=5^4+1:1:2*5^4
sys(j)=S12(j-5^4);
end
for j=2*5^4+1:1:3*5^4
sys(j)=S21(j-2*5^4);
end
for j=3*5^4+1:1:4*5^4
sys(j)=S22(j-3*5^4);
end
function sys=mdlOutputs(t,x,u)
global nmn1 nmn2 Fai
qd1=u(1);
qd2=u(2);
dqd1=0.3*cos(t);
dqd2=0.3*cos(t);
dqd=[dqd1 dqd2]';
ddqd1=-0.3*sin(t);
ddqd2=-0.3*sin(t);
ddqd=[ddqd1 ddqd2]';
q1=u(3);dq1=u(4);
q2=u(5);dq2=u(6);
ddq1=u(9);ddq2=u(10);
for l1=1:1:5
gs1=-[(q1+pi/6-(l1-1)*pi/12)/(pi/24)]^2;
u1(l1)=exp(gs1);
end
for l2=1:1:5
gs2=-[(dq1+pi/6-(l2-1)*pi/12)/(pi/24)]^2;
u2(l2)=exp(gs2);
end
for l3=1:1:5
gs3=-[(q2+pi/6-(l3-1)*pi/12)/(pi/24)]^2;
u3(l3)=exp(gs3);
end
for l4=1:1:5
gs4=-[(dq2+pi/6-(l4-1)*pi/12)/(pi/24)]^2;
u4(l4)=exp(gs4);
end
for l5=1:1:5
gs5=-[(ddq1+pi/6-(l5-1)*pi/12)/(pi/24)]^2;
u5(l5)=exp(gs5);
end
for l6=1:1:5
gs6=-[(ddq2+pi/6-(l6-1)*pi/12)/(pi/24)]^2;
u6(l6)=exp(gs6);
end
fsd=0;
fsu=zeros(5^4,1);
for l1=1:5
for l2=1:5
for l3=1:5
for l4=1:5
fsu(5^3*(l1-1)+5^2*(l2-1)+5*(l3-1)+l4)=u1(l1)*u2(l2)*u3(l3)*u4(l4);
fsd=fsd+u1(l1)*u2(l2)*u3(l3)*u4(l4);
end
end
end
end
fs=fsu/(fsd+0.001);
fsd1=0;
fsu1=zeros(5^4,1);
for l1=1:5
for l2=1:5
for l5=1:5
for l6=1:5
fsu1(5^3*(l1-1)+5^2*(l2-1)+5*(l5-1)+l6)=u1(l1)*u2(l2)*u5(l5)*u6(l6);
fsd1=fsd1+u1(l1)*u2(l2)*u5(l5)*u6(l6);
end
end
end
end
fs1=fsu1/(fsd1+0.001);
e1=q1-qd1;
e2=q2-qd2;
e=[e1 e2]';
de1=dq1-dqd1;
de2=dq2-dqd2;
de=[de1 de2]';
s=de+Fai*e;
dqr=dqd-Fai*e;
ddqr=ddqd-Fai*de;
for i=1:1:5^4
thta1(i,1)=x(i);
end
for i=1:1:5^4
thta2(i,1)=x(i+5^4);
end
for i=1:1:5^4
thta3(i,1)=x(i+2*5^4);
end
for i=1:1:5^4
thta4(i,1)=x(i+3*5^4);
end
%///////////////////////
r1=1;r2=0.8;
m1=1;m2=0.8;
D11=(m1+m2)*r1^2+m2*r2^2+2*m2*r1*r2*cos(q2);
D22=m2*r2^2;
D21=m2*r2^2+m2*r1*r2*cos(q2);
D12=D21;
D=[D11 D12;D21 D22];
C12=m2*r1*sin(q2);
C=[-C12*dq2 -C12*(dq1+dq2);C12*q1 0];
g1=(m1+m2)*r1*cos(q2)+m2*r2*cos(q1+q2);
g2=m2*r2*cos(q1+q2);
G=[g1;g2];
Fp11=thta1'*fs;
Fp12=thta2'*fs;
Fp21=thta3'*fs1;
Fp22=thta4'*fs1;
Fp1=[Fp11 Fp12]';
Fp2=[Fp21 Fp22]';
KD=10*eye(2);
W=[2 0;0 2];
M=1;
if M==1
tol=D*ddqr+C*dqr+G+Fp1+Fp2-KD*s; % (4.83)
elseif M==2
tol=D*ddqr+C*dqr+G+Fp1+Fp2-KD*s-W*sign(s); % (4.86)
end
sys(1)=tol(1);
sys(2)=tol(2);
sys(3)=Fp1(1)+Fp2(1);
sys(4)=Fp1(2)+Fp2(2);
没有合适的资源?快使用搜索试试~ 我知道了~
刘金琨机器人控制系统的设计与Matlab仿真程序
共193个文件
m:147个
mdl:39个
r2011a:6个
需积分: 48 39 下载量 130 浏览量
2018-01-20
20:13:53
上传
评论 3
收藏 406KB ZIP 举报
温馨提示
刘金琨老师机器人控制系统的设计与Matlab仿真-基本设计方法最新的程序代码,MATLAB程序,可以复现书中的仿真图,适合非线性控制研究者。
资源推荐
资源详情
资源评论
收起资源包目录
刘金琨机器人控制系统的设计与Matlab仿真程序 (193个子文件)
chap4_6ctrl.m 5KB
chap9_4system.m 4KB
chap4_5ctrl.m 3KB
chap4_4ctrl.m 3KB
chap5_3.m 2KB
chap3_2ctrl.m 2KB
chap9_2system.m 2KB
chap4_2ctrl.m 2KB
chap7_2ctrl.m 2KB
chap3_2plant.m 2KB
chap9_4xd.m 2KB
chap9_5plant.m 2KB
chap4_1ctrl.m 2KB
chap7_5ctrl.m 2KB
chap5_10.m 2KB
chap5_1main.m 2KB
chap5_7main.m 2KB
chap5_5plant.m 2KB
chap5_4plant.m 2KB
chap5_5main.m 1KB
chap7_1ctrl.m 1KB
chap5_8main.m 1KB
chap8_2plant.m 1KB
chap5_4main.m 1KB
chap5_9main.m 1KB
chap5_2main.m 1KB
chap9_5ctrl.m 1KB
chap8_1ctrl.m 1KB
chap2_2ctrl.m 1KB
chap3_1ctrl.m 1KB
chap7_1plant.m 1KB
chap4_6plant.m 1KB
chap5_1plant.m 1KB
chap7_2plant.m 1KB
chap7_4obv.m 1KB
chap4_3ctrl.m 1KB
chap7_4ctrl.m 1KB
chap6_3ctrl.m 1KB
chap9_3ctrl.m 1KB
chap5_7plant.m 1KB
chap4_8ctrl.m 1KB
chap2_2plant.m 1KB
chap7_5plant.m 1KB
chap4_4plant.m 1KB
chap4_5plant.m 1KB
chap9_2plot.m 1KB
chap5_7ctrl.m 1KB
chap2_1plant.m 1KB
chap9_3plant.m 1KB
chap6_2ctrl.m 1KB
chap5_5ctrl.m 1KB
chap7_4plant.m 1KB
chap5_7adapt.m 1KB
chap9_3plot.m 1KB
chap6_1plant.m 1KB
chap9_4plot.m 999B
chap7_4plot.m 992B
chap8_2LMI_design.m 969B
chap5_1ctrl.m 961B
chap4_8LMI_design.m 951B
chap6_3plant.m 944B
chap4_2plant.m 938B
chap4_7ctrl.m 929B
chap9_3input.m 924B
chap6_2plant.m 916B
chap5_8ctrl.m 912B
chap4_8mf.m 908B
chap4_5plot.m 898B
chap2_2plot.m 891B
chap5_6main.m 878B
chap4_3plant.m 873B
chap9_3TD.m 867B
chap5_4ctrl.m 864B
chap4_1plant.m 863B
chap4_7plant.m 852B
chap4_8plant.m 852B
chap9_1ctrl.m 843B
chap5_9ctrl.m 835B
chap9_4input.m 832B
chap7_3obv.m 830B
chap5_6plant.m 820B
chap9_5plot.m 813B
chap5_8adapt.m 811B
chap8_1plant.m 805B
chap3_2input.m 805B
chap8_2plot.m 798B
chap5_2plant.m 798B
chap6_1ctrl.m 785B
chap9_2input.m 780B
chap7_3plant.m 779B
chap8_1input.m 777B
chap2_1ctrl.m 770B
chap3_2plot.m 763B
chap7_2plot.m 756B
chap3_1plant.m 748B
chap5_12int.m 744B
chap10_2int.m 744B
chap5_9adapt.m 743B
chap5_2ctrl.m 740B
chap2_2input.m 736B
共 193 条
- 1
- 2
资源评论
平常心1204
- 粉丝: 41
- 资源: 35
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功