📄 demohop4.html
字号:
<!--This HTML is auto-generated from an m-file.Your changes will be overwritten.--><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:x-large">Spurious Stable Points</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">A Hopfield network with five neurons is designed to have four stableequilibria. However, unavoidably, it has other undesired equilibria.</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Copyright 1992-2002 The MathWorks, Inc.$Revision: 1.18 $ $Date: 2002/03/29 19:36:20 $</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">We would like to obtain a Hopfield network that has the four stable pointsdefined by the two target (column) vectors in T.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">T = [+1 +1 -1 +1; <span style="color:blue">...</span> -1 +1 +1 -1; <span style="color:blue">...</span><span style="color:green"> </span> -1 -1 -1 +1; <span style="color:blue">...</span> +1 +1 +1 +1; <span style="color:blue">...</span> -1 -1 +1 +1];</pre><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">The function NEWHOP creates Hopfield networks given the stable points T.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">net = newhop(T);</pre><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Here we define 4 random starting points and simulate the Hopfield network for50 steps.</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Some initial conditions will lead to desired stable points. Others will leadto undesired stable points.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">P = {rands(5,4)};[Y,Pf,Af] = sim(net,{4 50},{},P);Y{end}</pre><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:gray; font-style:italic;">ans = -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1</pre><originalCode xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" code="%% Spurious Stable Points
% A Hopfield network with five neurons is designed to have four stable
% equilibria. However, unavoidably, it has other undesired equilibria.
% 
% Copyright 1992-2002 The MathWorks, Inc.
% $Revision: 1.18 $ $Date: 2002/03/29 19:36:20 $

%%
% We would like to obtain a Hopfield network that has the four stable points
% defined by the two target (column) vectors in T.

T = [+1 +1 -1 +1; ...
 -1 +1 +1 -1; ... 
 -1 -1 -1 +1; ...
 +1 +1 +1 +1; ...
 -1 -1 +1 +1];

%%
% The function NEWHOP creates Hopfield networks given the stable points T.

net = newhop(T);

%%
% Here we define 4 random starting points and simulate the Hopfield network for
% 50 steps.
%
% Some initial conditions will lead to desired stable points. Others will lead
% to undesired stable points.

P = {rands(5,4)};
[Y,Pf,Af] = sim(net,{4 50},{},P);
Y{end}
"></originalCode>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -