第一范文网 - 专业文章范例文档资料分享平台

11基于遗传算法的机器人路径规划MATLAB源代码

来源:用户分享 时间:2025/6/4 14:27:40 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

欢迎访问GreenSim团队主页→http://blog.sina.com.cn/greensim 邮箱:greensim@163.com hold on end

title('遗传算法第40代') hold on

for i=1:(length(R)-1) x1=XY1(i,1); y1=XY1(i,2); x2=XY1(i+1,1); y2=XY1(i+1,2);

plot([x1,x2],[y1,y2],'k','LineWidth',1); hold on end end

if counter==50

PPP=[0.5,Xp,0.5]'; PPPP=1-PPP;

X=PPP.*X1+PPPP.*X2; Y=PPP.*Y1+PPPP.*Y2; XY2=[X,Y]; figure(7) PlotGraph; hold on

for i=1:(length(R)-1) x1=XY2(i,1); y1=XY2(i,2); x2=XY2(i+1,1); y2=XY2(i+1,2); plot([x1,x2],[y1,y2],'k'); hold on end

title('遗传算法第50代') hold on for i=1:(length(R)-1) x1=XY1(i,1); y1=XY1(i,2); x2=XY1(i+1,1); y2=XY1(i+1,2);

plot([x1,x2],[y1,y2],'k','LineWidth',1); hold on end end

LC2(counter+1)=Yp;

LC1(counter+1)=meanfitness; %% 第五步:变异

第6页

欢迎访问GreenSim团队主页→http://blog.sina.com.cn/greensim 邮箱:greensim@163.com for i=1:N

if Pm>rand&&pos(1)~=i AA=farm{i}; AA(POS)=rand; farm{i}=AA; end end

counter=counter+1; disp(counter); end

%% 输出遗传算法的优化结果 PPP=[0.5,Xp,0.5]'; PPPP=1-PPP;

X=PPP.*X1+PPPP.*X2; Y=PPP.*Y1+PPPP.*Y2; XY2=[X,Y]; L2=Yp;

%% 绘制Fig3 figure(8) PlotGraph; hold on hold on

for i=1:(length(R)-1) x1=XY1(i,1); y1=XY1(i,2); x2=XY1(i+1,1); y2=XY1(i+1,2);

plot([x1,x2],[y1,y2],'k','LineWidth',1); hold on end

for i=1:(length(R)-1) x1=XY2(i,1); y1=XY2(i,2); x2=XY2(i+1,1); y2=XY2(i+1,2); plot([x1,x2],[y1,y2],'k'); hold on end

title('遗传算法最终结果') figure(9) PlotGraph; hold on

for i=1:(length(R)-1) x1=XY1(i,1);

第7页

欢迎访问GreenSim团队主页→http://blog.sina.com.cn/greensim 邮箱:greensim@163.com y1=XY1(i,2); x2=XY1(i+1,1); y2=XY1(i+1,2);

plot([x1,x2],[y1,y2],'k','LineWidth',1); hold on end hold on

for i=1:(length(R)-1) x1=XY2(i,1); y1=XY2(i,2); x2=XY2(i+1,1); y2=XY2(i+1,2);

plot([x1,x2],[y1,y2],'k','LineWidth',2); hold on end

title('遗传算法优化前后结果比较') %% 绘制Fig4 figure(10); plot(LC1); hold on plot(LC2);

xlabel('迭代次数'); title('收敛曲线');

源代码运行结果展示

第8页

欢迎访问GreenSim团队主页→http://blog.sina.com.cn/greensim 邮箱:greensim@163.com

第9页

11基于遗传算法的机器人路径规划MATLAB源代码.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0sl299fjm52wkqq4m2m0_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top