clear;
clc;
%网络训练样本
pConvert=importdata('C:\Users\Administrator\Desktop\ln\SelfOrganizationtrain.dat');;
p=pConvert';
%训练样本的目标矩阵
t=importdata('C:\Users\Administrator\Desktop\ln\SelfOrganizationtarget.dat');
plot3(p(1,:),p(2,:),p(3,:),'o');
grid;box;
for i=1:29,text(p(1,i),p(2,i),p(3,i),sprintf(' %g',t(i))),end
hold off
f=t;
index1=find(f==1);
index2=find(f==2);
index3=find(f==3);
index4=find(f==4);
line(p(1,index1),p(2,index1),p(3,index1),'linestyle','none','marker','*','color','g');
line(p(1,index2),p(2,index2),p(3,index2),'linestyle','none','marker','*','color','r');
line(p(1,index3),p(2,index3),p(3,index3),'linestyle','none','marker','+','color','b');
line(p(1,index4),p(2,index4),p(3,index4),'linestyle','none','marker','+','color','y');
box;grid on;hold on;
axis([0 3500 0 3500 0 3500]);
title('训练用样本及其类别');
xlabel('A');
ylabel('B');
zlabel('C');
t=t';
t=ind2vec(t);
spread=30;
% PNN网络的创建和训练过程
net=newgrnn(p,t,spread);
A=sim(net,p)
Ac=vec2ind(A)
plot3(p(1,:),p(2,:),p(3,:),'.'),grid;box;
axis([0 3500 0 3500 0 3500])
for i=1:29,text(p(1,i),p(2,i),p(3,i),sprintf(' %g',Ac(i))),end
%以图形方式输出训练结果
hold off
f=Ac';
index1=find(f==1);
index2=find(f==2);
index3=find(f==3);
index4=find(f==4);
line(p(1,index1),p(2,index1),p(3,index1),'linestyle','none','marker','*','color','g');
line(p(1,index2),p(2,index2),p(3,index2),'linestyle','none','marker','*','color','r');
line(p(1,index3),p(2,index3),p(3,index3),'linestyle','none','marker','+','color','b');
line(p(1,index4),p(2,index4),p(3,index4),'linestyle','none','marker','+','color','y');
box;grid on;hold on;
title('网络训练结果');
xlabel('A');
ylabel('B');
zlabel('C');
%对待分类样本进行分类
pConvert=importdata('C:\Users\Administrator\Desktop\ln\SelfOrganizationSimulation.dat');
p=pConvert';
a=sim(net,p)
ac=vec2ind(a)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1、资源内容:基于Matlab实现神经网络GRNN算法(源码+数据).rar 2、适用人群:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业或毕业设计,作为“参考资料”使用。 3、解压说明:本资源需要电脑端使用WinRAR、7zip等解压工具进行解压,没有解压工具的自行百度下载即可。 4、免责声明:本资源作为“参考资料”而不是“定制需求”不一定能够满足所有人的需求,需要有一定的基础能够看懂代码,能够自行调试代码并解决报错,能够自行添加功能修改代码。由于作者大厂工作较忙,不提供答疑服务,如不存在资源缺失问题概不负责,谢谢理解。
资源推荐
资源详情
资源评论























收起资源包目录






共 4 条
- 1
资源评论

- m0_750603332024-01-07资源内容详实,描述详尽,解决了我的问题,受益匪浅,学到了。
- m0_625976392023-11-11发现一个宝藏资源,赶紧冲冲冲!支持大佬~
- a5586998876682024-05-01资源使用价值高,内容详实,给了我很多新想法,感谢大佬分享~

Matlab仿真实验室
- 粉丝: 4w+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
