📄 fmap1.m
字号:
%例6.5,fmap1.m
%
clear
pi=3.1416;
x=0:0.5*pi/99:0.5*pi;
P=[sin(x);cos(x)]; %画圆
plot(P(1,:),P(2,:),'b.'); %画输入点图
axis('equal')
[R,Q]=size(P);
S=20;
W0=rands(S,R)*0.1; %随机产生权值
hold on
plotsom(W0') %画权值点及其与相邻权值点的连线
hold off
disp('按任一键继续')
pause
net=newsom(minmax(P),S); %创建科荷伦网络
net.trainParam.epochs=200; %最大训练次数
net.trainParam.show = 20;
net = train(net,P); %训练网络
figure(2)
plot(P(1,:),P(2,:),'.g','markersize',20) %画输入点
hold on
plotsom(net.iw{1,1},net.layers{1}.distances)
%作训练后的权值点及其与相邻权值点的连线
hold off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -