SOMtest.m
上传用户:sdcdgc2008
上传日期:2014-04-13
资源大小:365k
文件大小:1k
- %------ SOM test --------
- close all
- clf reset
- figure(gcf)
- echo on
- clc
- % NEWSOM ---- 创建自组织网络
- % TRAIN ----- 训练
- % SIM------仿真
- clc
- % 产生样本数据 P
- angles = 0:0.5*pi/99:0.5*pi;
- P=[cos(angles);sin(angles)];
- % pause
- clc
- % 画第一幅图: 样本数据分布图
- plot(P(1,:),P(2,:),'*');
- axis([0 1 0 1]);
- title('Input data');
- % pause
- clc
- % 建立自组织网络
- % 样本分为九类
- net = newsom([0 1;0 1],[9]);
- % pause
- clc
- % 对网络训练
- net.trainParam.epochs = 10;
- [net,tr,Y,E,Pf,Af] = train(net,P);
- % pause
- clc
- a = sim(net,[0.6;0.8])
- % 画第二幅图: 权值
- figure;
- w = net.IW{1};
- plotsom(net.IW{1,1},net.layers{1}.distances);
- pause
- clcI
- % 利用一组新的数据测内容
- a = sim(net,[0.6;0.8])
- echo off