⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m10_8.m

📁 MATLAB控制系统仿真与实例详解(附书光盘)
💻 M
字号:
%指定存储在网络中的目标平衡点
                  T = [+1 +1;-1 +1; -1 -1];
                  axis([-1 1 -1 1 -1 1]);
                  set(gca,'box','on');
                  axis manual;
                  hold on;
                  plot3(T(1,:),T(2,:),T(3,:),'r*');
                  title('Hopfield神经网络状态空间');
                  xlabel('a(1)');
                  ylabel('a(2)');
                  zlabel('a(3)');
                  view([37.5 30]);
                  %建立网络,并得到权重和阈值
                  net=newhop(T);
                  W=net.LW{1,1}
                  b=net.b{1,1}
                  %使用一个随机点仿真网络,并绘出其到达稳定点的轨迹
                  a = {rands(3,1)};
                  [y,Pf,Af] = sim(net,{1 10},{},a);
                  figure;
                  axis([-1 1 -1 1 -1 1]);
                  set(gca,'box','on');
                  axis manual;
                  hold on;
                  plot3(T(1,:),T(2,:),T(3,:),'r*');
                  record=[cell2mat(a) cell2mat(y)];
                  start=cell2mat(a);
                  plot3(start(1,1),start(2,1),start(3,1),'bx',record(1,:),record(2,:),record(3,:));
                  view([37.5 30]);
                  title('Hopfield神经网络状态空间');
                  xlabel('a(1)');
                  ylabel('a(2)');
                  zlabel('a(3)');
                  %用多个随机点仿真网络,并绘出相应的轨迹
                  figure;
                  axis([-1 1 -1 1 -1 1]);
                  set(gca,'box','on');
                  axis manual;
                  hold on;
                  view([37.5 30]);
                  plot3(T(1,:),T(2,:),T(3,:),'r*');
                  color = 'rgbmy';
                  for i=1:25
                      a = {rands(3,1)};
                      [y,Pf,Af] = sim(net,{1 10},{},a);
                      record=[cell2mat(a) cell2mat(y)];
                      start=cell2mat(a);
                      
                  plot3(start(1,1),start(2,1),start(3,1),'kx',record(1,:),record(2,:),record(3,:),color(rem(i,5)+1))
                      drawnow
                  end
                  title('Hopfield神经网络状态空间');
                  xlabel('a(1)');
                  ylabel('a(2)');
                  zlabel('a(3)');
                 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -