赞
踩
function dx= exercisesub(t,x,u,d)
J=2.0;
d=sin(t);
x1dot=x(2);
x2dot=(1/J)*u+(1/J)*d;
dx=[x1dot; x2dot];
----------------------------
主程序:
clear;close;clc;
% setting known values;
c=10;
k=10;
J=2;
xite=1.1;
x0=[0 0]; % Initial Conditions;这里设定了x0的初值
y(1,1)=x0(1);
x1(1)=x0(1,1);
x2(1)=x0(1,2);
timestep=0.01; % Integration step;
t0=0.0;
tfinal=0.0;
d(1,1)=sin(t0); % setting d=sin(t) as disterbance term;
iterations=1000; % setting iterations range, repeat from 2 to 1000;
th_ref=ones(iterations,1); % design th_ref as reference;
e(1,1)=th_ref(1,1)-x1(1,1); %tracking error;
edot(1,1)=-x2(1,1); % derivative of e, the derivative
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。