clear all;
close all;
global TE G ts
Size=50; %样本个数
D=4; %每个样本有4个固定点,即分成4段
F=0.5; %变异因子
CR=0.9; %交叉因子
Nmax=30; %DE优化次数
TE=1; %参考轨迹参数TE
thd=0.50;
aim=[TE;thd];%摆线路径终点
start=[0;0];%路径起点
tmax=3*TE; %仿真时间
ts=0.001; %Sampling time
G=tmax/ts; %仿真时间为G=3000
%***************摆线参考轨迹*************%
th0=0;
dT=TE/1000; %将TE分为1000个点,每段长度(步长)为dT
for k=1:1:G
t(k)=k*dT; %t(1)=0.001;t(2)=0.002;.....
if t(k)<TE
thr(k)=(thd-th0)*(t(k)/TE-1/(2*pi)*sin(2*pi*t(k)/TE))+th0; %不含原点的参考轨迹(1)
else
thr(k)=thd;
end
end
%***************初始化路径**************%
for i=1:Size
for j=1:D
Path(i,j)=rand*(thd-th0)+th0;
end
end
%**********差分进化计算***************%
for N=1:Nmax
%**************变异**************%
for i=1:Size
r1=ceil(Size*rand);
r2=ceil(Size*rand);
r3=ceil(Size*rand);
while(r1==r2||r1==r3||r2==r3||r1==i||r2==i||r3==i)%选取不同的r1,r2,r3,且不等于i
r1=ceil(Size*rand);
r2=ceil(Size*rand);
r3=ceil(Size*rand);
end
for j=1:D
mutate_Path(i,j)=Path(r1,j)+F.*(Path(r2,j)-Path(r3,j));%选择前半部分产生变异个体
end
%****************交叉****************%
for j=1:D
if rand<=CR
cross_Path(i,j)=mutate_Path(i,j);
else
cross_Path(i,j)=Path(i,j);
end
end
%先进行三次样条插值,此为D=4时的特殊情况%
XX(1)=0;XX(2)=200*dT;XX(3)=400*dT;XX(4)=600*dT;XX(5)=800*dT;XX(6)=1000*dT;
YY(1)=th0;YY(2)=cross_Path(i,1);YY(3)=cross_Path(i,2);YY(4)=cross_Path(i,3);YY(5)=cross_Path(i,4);YY(6)=thd;
dY=[0 0];
cross_Path_spline=spline(XX,YY,linspace(0,1,1000));%输出插值拟合后的曲线,注意步长nt的一致,此时输出1000个点
YY(2)=Path(i,1);YY(3)=Path(i,2);YY(4)=Path(i,3);YY(5)=Path(i,4);
Path_spline=spline(XX,YY,linspace(0,1,1000));
%*** 计算指标并比较***%
for k=1:1000
distance_cross(i,k)=abs(cross_Path_spline(k)-thr(k)); %计算交叉后的轨迹与参考轨迹的距离值
distance_Path(i,k)=abs(Path_spline(k)-thr(k)); %计算插值后的轨迹与参考轨迹的距离值
end
new_object = chap10_4obj(cross_Path_spline,distance_cross(i,:),0); %计算交叉后的能量消耗最低及路径逼近最佳值的和
formal_object = chap10_4obj(Path_spline,distance_Path(i,:),0); %计算插值后的能量消耗最低及路径逼近最佳值的和
%%%%%%%%%% 选择算法 %%%%%%%%%%%
if new_object<=formal_object
Fitness(i)=new_object;
Path(i,:)=cross_Path(i,:);
else
Fitness(i)=formal_object;
Path(i,:)=Path(i,:);
end
end
[iteraion_fitness(N),flag]=min(Fitness);%记下第NC次迭代的最小数值及其维数
lujing(N,:)=Path(flag,:) %第NC次迭代的最佳路径
fprintf('N=%d Jmin=%g\n',N,iteraion_fitness(N));
end
[Best_fitness,flag1]=min(iteraion_fitness);
Best_solution=lujing(flag1,:);
YY(2)=Best_solution(1);YY(3)=Best_solution(2);YY(4)=Best_solution(3);YY(5)=Best_solution(4);
Finally_spline=spline(XX,YY,linspace(0,1,1000));
chap10_4obj(Finally_spline,distance_Path(Size,:),1);
figure(3);
plot((0:0.001:1),[0,thr(1:1:1000)],'k','linewidth',2);
xlabel('Time (s)');ylabel('Ideal Path');
hold on;
plot((0:0.2:1), YY,'ko','linewidth',2);
hold on;
plot((0:0.001:1),[0,Finally_spline],'k-.','linewidth',2);
xlabel('Time (s)');ylabel('Optimized Path');
legend('Ideal Path','Interpolation points','Optimized Path');
figure(4);
plot((1:Nmax),iteraion_fitness,'k','linewidth',2);
xlabel('Time (s)');ylabel('Fitness Change');
没有合适的资源?快使用搜索试试~ 我知道了~
滑模变结构控制matlab仿真(第三版)先进控制系统设计方法源码
共287个文件
m:219个
mdl:47个
r2011a:17个
5星 · 超过95%的资源 需积分: 50 147 下载量 14 浏览量
2017-10-07
15:23:05
上传
评论 7
收藏 645KB RAR 举报
温馨提示
滑模变结构控制matlab仿真(第三版)先进控制系统设计方法源码
资源推荐
资源详情
资源评论
收起资源包目录
滑模变结构控制matlab仿真(第三版)先进控制系统设计方法源码 (287个子文件)
chap2_2sim.mdl.autosave 28KB
chap2_3sim.mdl.autosave 26KB
~$.3 基于最优轨迹规划器的滑模控制.docx 162B
chap10_4.m 4KB
chap5_8system.m 3KB
chap11_5.m 3KB
chap6_3ctrl.m 3KB
chap11_4.m 3KB
chap11_3.m 3KB
chap9_8plot.m 3KB
chap11_2.m 2KB
chap6_2ctrl.m 2KB
chap6_1ctrl.m 2KB
chap9_8Aplant.m 2KB
chap9_8Actrl.m 2KB
chap5_7system.m 2KB
chap11_1.m 2KB
chap10_4obj.m 2KB
chap6_1plant.m 2KB
chap5_8xd.m 2KB
chap9_8Pctrl.m 2KB
chap10_2.m 2KB
chap5_5ctrl.m 2KB
chap5_9plant.m 2KB
chap8_5obv.m 2KB
chap9_2ctrl.m 2KB
chap9_6ctrl2.m 2KB
chap3_3ctrl.m 2KB
chap9_7plot.m 2KB
chap5_6adapt.m 2KB
chap9_1ctrl.m 2KB
chap9_6plant.m 2KB
chap8_6obv.m 1KB
chap9_7Pctrl.m 1KB
chap9_6ctrl1.m 1KB
chap5_1ctrl.m 1KB
chap5_2ctrl.m 1KB
chap5_6ctrl.m 1KB
chap9_7Actrl.m 1KB
chap1_3ctrl.m 1KB
chap5_9ctrl.m 1KB
chap8_3ctrl.m 1KB
chap9_8Pplant.m 1KB
chap1_2ctrl.m 1KB
chap2_2obv.m 1KB
chap7_3obv.m 1KB
chap9_5plot.m 1KB
chap7_1ctrl.m 1KB
chap7_3ctrl.m 1KB
chap9_2plant.m 1KB
chap5_6plant.m 1KB
chap6_3plant.m 1KB
chap5_3ctrl.m 1KB
chap9_1plant.m 1KB
chap9_10ctrl1.m 1KB
chap2_2ctrl.m 1KB
chap5_1plant.m 1KB
chap2_3ctrl.m 1KB
chap1_1ctrl.m 1KB
chap6_3plot.m 1KB
chap5_7plot.m 1KB
chap7_1plant.m 1KB
chap1_7ctrl.m 1KB
chap3_1ctrl.m 1KB
chap5_5plot.m 1KB
chap8_6v2bar.m 1KB
chap5_2plant.m 1KB
chap6_2plant.m 1KB
chap4_1.m 1KB
chap8_2ctrl.m 1KB
chap1_3plant.m 1KB
chap2_2plant.m 1KB
chap5_6plot.m 1KB
chap9_7Aplant.m 1KB
chap9_7Pplant.m 1KB
chap8_1obv.m 1KB
chap9_4plot.m 1KB
chap5_5plant.m 1KB
chap9_2plot.m 1KB
chap7_3plant.m 1KB
chap8_2obv.m 1KB
chap2_3plant.m 1KB
chap9_10plot.m 1KB
chap9_9plot.m 1KB
chap1_5ctrl.m 1KB
chap6_1plot.m 1KB
chap5_4ctrl.m 1KB
chap9_9ctrl1.m 1KB
chap3_2rbf.m 1KB
chap8_4ctrl.m 1KB
chap7_1obv.m 1KB
chap1_6ctrl.m 1KB
chap4_3sharp.m 1KB
chap2_1obv.m 1020B
chap9_4M.m 1017B
chap5_8plot.m 998B
chap1_5plant.m 997B
chap8_3plant.m 996B
chap7_3plot.m 992B
chap7_1plot.m 992B
共 287 条
- 1
- 2
- 3
yefly
- 粉丝: 2
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 前端vue框架,后端ssm+springboot框架,网站开发.zip
- 基于springboot的快速开发框架.zip
- 基于springboot的分布式权限管理系统,易读易懂、界面简洁美观.zip
- 基于SpringBoot Mybatis-Plus TypeScript的微服务多租户SaaS管理快速开发框架 .zip
- 论文复现:QA-GNN: Reasoning with Language Models and Knowledge
- ipp(intel-oneAPI)下载地址.txt
- 基于spring-boot dubbox搭建的java分布式系统的前端管理.zip
- VLC+Qt demoVLC+Qt demo
- 海彪&龙梅子 - 寂寞的人伤心的歌 (DJ版) [mqms2].ogg
- 530springboot + vue 旅游管理系统.zip(可运行源码+数据库文件+文档)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页