-
-
Save mikolasan/5f40cbea6db57bedc96c8bb6762c9ab0 to your computer and use it in GitHub Desktop.
Hopfield network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net = newhop(stimul); | |
Ai = stimul; | |
[Y,Pf,Af] = sim(net,360,[],Ai); | |
W= net.LW{1,1}; | |
norm(stimul-Y) | |
otv=[]; | |
ot=Y(:,2); | |
for n=1:96 | |
otv(mod(n-1,8)+1,floor((n-1)/8)+1)=ot(n); | |
end | |
otv=otv'; | |
pcolor(otv);figure(gcf); | |
a={stimul(:,38)}; | |
[y,Pf,Af] = sim(net,{1 20},{},a); | |
ot=cell2mat(y(:,20));otv=[]; | |
for n=1:96 | |
otv(mod(n-1,8)+1,floor((n-1)/8)+1)=ot(n); | |
end | |
otv=otv'; | |
pcolor(otv);figure(gcf); | |
a={rand(96,1)}; | |
[y,Pf,Af] = sim(net,{1 20},{},a); | |
ot=cell2mat(y(:,20));otv=[]; | |
for n=1:96 | |
otv(mod(n-1,8)+1,floor((n-1)/8)+1)=ot(n); | |
end | |
otv=otv'; | |
pcolor(otv);figure(gcf); | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
t=stimul; | |
[S,Q] = size(t); | |
Y = t(:,1:Q-1)-t(:,Q)*ones(1,Q-1); | |
[U,SS,V] = svd(Y); | |
K = rank(SS); | |
TP = zeros(S,S); | |
for k=1:K | |
TP = TP + U(:,k)*U(:,k)'; | |
end | |
TM = zeros(S,S); | |
for k=K+1:S | |
TM = TM + U(:,k)*U(:,k)'; | |
end | |
tau = 10; | |
Ttau = TP - tau*TM; | |
Itau = t(:,Q) - Ttau*t(:,Q); | |
h = 0.15; | |
C1 = exp(h)-1; | |
C2 = -(exp(-tau*h)-1)/tau; | |
w = expm(h*Ttau); | |
b = U * [ C1*eye(K) zeros(K,S-K); | |
zeros(S-K,K) C2*eye(S-K)] * U' * Itau; | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%%% BASIC hopf | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
correct=0; | |
error=0; | |
for k=1:Q | |
x=t(:,k); | |
while( norm(satlins(W*x)-x)>0 ) | |
x=satlins(W*x); | |
end | |
if( norm(x-t(:,k))>0 ) | |
error=error+1; | |
else | |
correct=correct+1; | |
end | |
end | |
%%%%%%%%%%%%%% | |
%%%%%%%%%%%%% CHop | |
t=data; | |
[S,Q] = size(t); | |
W=zeros(S); | |
for k=1:Q | |
W = W + (1/Q)*t(:,k)*t(:,k)'; | |
end | |
for k=1:S | |
W(k,k)=0; | |
end | |
CHD=[];CY=[]; | |
for k=1:Q | |
u=t(:,k); | |
while( norm(satlins(W*u)-u)>0 ) | |
u=satlins(W*u); | |
end | |
CY=[CY u];x=idealo(:,k)-u; | |
hd=0; | |
for l=1:S | |
if( x(l)~=0 ) | |
hd=hd+1; | |
end | |
end | |
if(hd==0) | |
disp(k) | |
end | |
CHD=[CHD hd]; | |
end | |
CHOP=zeros(12,1); | |
for s=1:Q | |
CHOP(floor((s-1)/30)+1)=CHOP(floor((s-1)/30)+1)+CHD(s); | |
end | |
CHOP=CHOP/30; | |
%%%%%%%%%%%%% Hop | |
HD=[]; | |
for k=1:Q | |
x=idealo(:,k)-Y(:,k); | |
hd=0; | |
for l=1:S | |
if( x(l)~=0 ) | |
hd=hd+1; | |
end | |
end | |
if(hd==0) | |
disp(k) | |
end | |
HD=[HD hd]; | |
end | |
HOP=zeros(12,1); | |
for s=1:Q | |
HOP(floor((s-1)/30)+1)=HOP(floor((s-1)/30)+1)+HD(s); | |
end | |
HOP=HOP/30; | |
%%%%%%%%%%%%% SD | |
SD=[]; | |
for k=1:Q | |
x=idealo(:,k)-rsd(:,k); | |
hd=0; | |
for l=1:S | |
if( x(l)~=0 ) | |
hd=hd+1; | |
end | |
end | |
SD=[SD hd]; | |
end | |
HSD=zeros(12,1); | |
for s=1:360 | |
HSD(floor((s-1)/30)+1)=HSD(floor((s-1)/30)+1)+SD(s); | |
end | |
HSD=HSD/30; | |
BAR(:,1)=HSD; | |
BAR(:,2)=HOP; | |
BAR(:,3)=CHOP; | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%%% how many classes do you have? | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
t=Y; | |
class=360; | |
for n1=1:360 | |
for n2=n1+1:360 | |
if(norm(t(:,n1)-t(:,n2))==0) | |
disp([n1 n2]) | |
class=class-1; | |
break | |
end | |
end | |
end | |
ideal=flipud(ideal); | |
otv=[]; | |
ot=ideal(:,71); | |
for n=1:96 | |
otv(floor((n-1)/8)+1,mod(n-1,8)+1)=ot(n); | |
end | |
% Create figure | |
figure1 = figure('PaperSize',[20.98404194812 29.67743169791],... | |
'Colormap',[1 1 1;1 1 0.857142865657806;1 1 0.714285731315613;1 1 0.571428596973419;1 1 0.428571432828903;1 1 0.28571429848671;1 1 0.142857149243355;1 1 0;0.991911768913269 0.968137264251709 0;0.983823537826538 0.936274528503418 0;0.975735306739807 0.904411792755127 0;0.967647075653076 0.872548997402191 0;0.959558844566345 0.8406862616539 0;0.951470613479614 0.808823525905609 0;0.943382382392883 0.776960790157318 0;0.935294151306152 0.745098054409027 0;0.927205860614777 0.713235318660736 0;0.919117629528046 0.6813725233078 0;0.911029398441315 0.649509787559509 0;0.902941167354584 0.617647051811218 0;0.894852936267853 0.585784316062927 0;0.886764705181122 0.553921580314636 0;0.878676474094391 0.522058844566345 0;0.87058824300766 0.490196079015732 0;0.858823537826538 0.488725483417511 0;0.847058832645416 0.487254917621613 0;0.835294127464294 0.485784322023392 0;0.823529422283173 0.484313726425171 0;0.811764717102051 0.48284313082695 0;0.800000011920929 0.481372535228729 0;0.788235306739807 0.479901969432831 0;0.776470601558685 0.47843137383461 0;0.764705896377563 0.476960778236389 0;0.752941191196442 0.475490212440491 0;0.74117648601532 0.47401961684227 0;0.729411780834198 0.472549021244049 0;0.717647075653076 0.471078425645828 0;0.705882370471954 0.469607830047607 0;0.694117665290833 0.468137264251709 0;0.682352960109711 0.466666668653488 0;0.671078443527222 0.468872547149658 0.0313725508749485;0.659803926944733 0.471078425645828 0.062745101749897;0.648529410362244 0.473284333944321 0.0941176563501358;0.637254953384399 0.475490212440491 0.125490203499794;0.62598043680191 0.477696090936661 0.156862750649452;0.614705920219421 0.479901969432831 0.188235312700272;0.603431403636932 0.482107847929001 0.21960785984993;0.592156887054443 0.484313726425171 0.250980406999588;0.580882370471954 0.486519634723663 0.282352954149246;0.569607853889465 0.488725513219833 0.313725501298904;0.558333337306976 0.490931391716003 0.345098048448563;0.547058820724487 0.493137270212173 0.376470625400543;0.535784363746643 0.495343148708344 0.407843172550201;0.524509847164154 0.497549057006836 0.43921571969986;0.513235330581665 0.499754935503006 0.470588266849518;0.501960813999176 0.501960813999176 0.501960813999176;0.43921571969986 0.43921571969986 0.43921571969986;0.376470625400543 0.376470625400543 0.376470625400543;0.313725501298904 0.313725501298904 0.313725501298904;0.250980406999588 0.250980406999588 0.250980406999588;0.188235312700272 0.188235312700272 0.188235312700272;0.125490203499794 0.125490203499794 0.125490203499794;0.062745101749897 0.062745101749897 0.062745101749897;0 0 0]); | |
% Create axes | |
axes1 = axes('Parent',figure1,'YTickLabel',{'2','4','6','8','10','12'},... | |
'YTick',[2.5 4.5 6.5 8.5 10.5 12.5],... | |
'YGrid','on',... | |
'YDir','reverse',... | |
'XTickLabel',{'2','4','6','8'},... | |
'XTick',[2.5 4.5 6.5 8.5],... | |
'XGrid','on',... | |
'Position',[0.0954107520333119 0.0668345743049818 0.883942766295707 0.920469361147327],... | |
'Layer','top',... | |
'FontSize',16,... | |
'FontName','DejaVu Sans Mono'); | |
% preserve the X-limits of the axes | |
xlim(axes1,[0.5 8.5]); | |
% preserve the Y-limits of the axes | |
ylim(axes1,[0.5 12.5]); | |
box(axes1,'on'); | |
hold(axes1,'all'); | |
% Create image | |
image(otv,'Parent',axes1,'CDataMapping','scaled'); | |
data=[]; | |
for k=1:360 | |
t=k-1; | |
id=mod(floor(t/10),3)*120+floor(t/30)*10+mod(t,10)+1; | |
data(:,k)=data0(:,id); | |
end | |
alld=[]; | |
space=2; | |
for p=1:360 | |
otv=[]; | |
ot=data(:,p); | |
for n=1:96 | |
otv(floor((n-1)/8)+1,mod(n-1,8)+1)=ot(n); | |
end | |
x=mod(p-1,30)*space; | |
y=floor((p-1)/30)*space; | |
a=floor((p-1)/30)*12+1+y:(floor((p-1)/30)+1)*12+y; | |
b=x+mod(p-1,30)*8+1:x+(mod(p-1,30)+1)*8; | |
alld(a, b)=otv; | |
end | |
% Create figure | |
figure1 = figure('PaperSize',[20.98404194812 29.67743169791],... | |
'Colormap',[1 1 1;1 1 0.857142865657806;1 1 0.714285731315613;1 1 0.571428596973419;1 1 0.428571432828903;1 1 0.28571429848671;1 1 0.142857149243355;1 1 0;0.991911768913269 0.968137264251709 0;0.983823537826538 0.936274528503418 0;0.975735306739807 0.904411792755127 0;0.967647075653076 0.872548997402191 0;0.959558844566345 0.8406862616539 0;0.951470613479614 0.808823525905609 0;0.943382382392883 0.776960790157318 0;0.935294151306152 0.745098054409027 0;0.927205860614777 0.713235318660736 0;0.919117629528046 0.6813725233078 0;0.911029398441315 0.649509787559509 0;0.902941167354584 0.617647051811218 0;0.894852936267853 0.585784316062927 0;0.886764705181122 0.553921580314636 0;0.878676474094391 0.522058844566345 0;0.87058824300766 0.490196079015732 0;0.858823537826538 0.488725483417511 0;0.847058832645416 0.487254917621613 0;0.835294127464294 0.485784322023392 0;0.823529422283173 0.484313726425171 0;0.811764717102051 0.48284313082695 0;0.800000011920929 0.481372535228729 0;0.788235306739807 0.479901969432831 0;0.776470601558685 0.47843137383461 0;0.764705896377563 0.476960778236389 0;0.752941191196442 0.475490212440491 0;0.74117648601532 0.47401961684227 0;0.729411780834198 0.472549021244049 0;0.717647075653076 0.471078425645828 0;0.705882370471954 0.469607830047607 0;0.694117665290833 0.468137264251709 0;0.682352960109711 0.466666668653488 0;0.671078443527222 0.468872547149658 0.0313725508749485;0.659803926944733 0.471078425645828 0.062745101749897;0.648529410362244 0.473284333944321 0.0941176563501358;0.637254953384399 0.475490212440491 0.125490203499794;0.62598043680191 0.477696090936661 0.156862750649452;0.614705920219421 0.479901969432831 0.188235312700272;0.603431403636932 0.482107847929001 0.21960785984993;0.592156887054443 0.484313726425171 0.250980406999588;0.580882370471954 0.486519634723663 0.282352954149246;0.569607853889465 0.488725513219833 0.313725501298904;0.558333337306976 0.490931391716003 0.345098048448563;0.547058820724487 0.493137270212173 0.376470625400543;0.535784363746643 0.495343148708344 0.407843172550201;0.524509847164154 0.497549057006836 0.43921571969986;0.513235330581665 0.499754935503006 0.470588266849518;0.501960813999176 0.501960813999176 0.501960813999176;0.43921571969986 0.43921571969986 0.43921571969986;0.376470625400543 0.376470625400543 0.376470625400543;0.313725501298904 0.313725501298904 0.313725501298904;0.250980406999588 0.250980406999588 0.250980406999588;0.188235312700272 0.188235312700272 0.188235312700272;0.125490203499794 0.125490203499794 0.125490203499794;0.062745101749897 0.062745101749897 0.062745101749897;0 0 0]); | |
% Create axes | |
axes1 = axes('Parent',figure1,'YTickLabel',{'2','4','6','8','10','12'},... | |
'YTick',[2.5 4.5 6.5 8.5 10.5 12.5],... | |
'YGrid','on',... | |
'YDir','reverse',... | |
'XTickLabel',{'2','4','6','8'},... | |
'XTick',[2.5 4.5 6.5 8.5],... | |
'XGrid','on',... | |
'Position',[0.0954107520333119 0.0668345743049818 0.883942766295707 0.920469361147327],... | |
'Layer','top',... | |
'FontSize',16,... | |
'FontName','DejaVu Sans Mono'); | |
% preserve the X-limits of the axes | |
xlim(axes1,[0.5 8.5]); | |
% preserve the Y-limits of the axes | |
ylim(axes1,[0.5 12.5]); | |
box(axes1,'on'); | |
hold(axes1,'all'); | |
% Create image | |
image(otv,'Parent',axes1,'CDataMapping','scaled'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t=hardlims(rand(40,4)*2-1); | |
[S,Q] = size(t); | |
CW=zeros(S); | |
for k=1:Q | |
CW = CW + (1/Q)*t(:,k)*t(:,k)'; | |
end | |
CW=CW-eye(S); | |
CY=[]; | |
for k=1:Q | |
u=t(:,k); | |
while( norm(hardlims(CW*u)-u)>0 ) | |
u=hardlims(CW*u); | |
end | |
CY=[CY u]; | |
end | |
CY | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%%% BASIC hopf | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
data0=data0'; | |
data=[]; | |
for k=1:360 | |
t=k-1; | |
id=mod(floor(t/10),3)*120+floor(t/30)*10+mod(t,10)+1; | |
data(:,k)=data0(:,id); | |
end | |
g=2; | |
d=1/(Q*g); | |
t=data(:,1:360); | |
[S,Q] = size(t); | |
CW=zeros(S); | |
for k=1:Q | |
CW = CW + (1-k*d)*t(:,k)*t(:,k)';%%CW = CW + (1/(k+2))*t(:,k)*t(:,k)'; | |
end | |
CW=CW-eye(S); | |
CW=normr(CW); | |
CY=[]; | |
for k=1:Q | |
u=t(:,k); | |
while( norm(satlins(CW*u)-u)>0 ) | |
u=satlins(CW*u); | |
end | |
CY=[CY u]; | |
end | |
calld=[]; | |
space=2; | |
for p=1:Q | |
otv=[]; | |
ot=CY(:,p); | |
for n=1:96 | |
otv(floor((n-1)/8)+1,mod(n-1,8)+1)=ot(n); | |
end | |
x=mod(p-1,30)*space; | |
y=floor((p-1)/30)*space; | |
a=floor((p-1)/30)*12+1+y:(floor((p-1)/30)+1)*12+y; | |
b=x+mod(p-1,30)*8+1:x+(mod(p-1,30)+1)*8; | |
calld(a, b)=otv; | |
end | |
% Create figure | |
figure1 = figure('PaperSize',[20.98404194812 29.67743169791],... | |
'Colormap',[1 1 1;1 1 0.857142865657806;1 1 0.714285731315613;1 1 0.571428596973419;1 1 0.428571432828903;1 1 0.28571429848671;1 1 0.142857149243355;1 1 0;0.991911768913269 0.968137264251709 0;0.983823537826538 0.936274528503418 0;0.975735306739807 0.904411792755127 0;0.967647075653076 0.872548997402191 0;0.959558844566345 0.8406862616539 0;0.951470613479614 0.808823525905609 0;0.943382382392883 0.776960790157318 0;0.935294151306152 0.745098054409027 0;0.927205860614777 0.713235318660736 0;0.919117629528046 0.6813725233078 0;0.911029398441315 0.649509787559509 0;0.902941167354584 0.617647051811218 0;0.894852936267853 0.585784316062927 0;0.886764705181122 0.553921580314636 0;0.878676474094391 0.522058844566345 0;0.87058824300766 0.490196079015732 0;0.858823537826538 0.488725483417511 0;0.847058832645416 0.487254917621613 0;0.835294127464294 0.485784322023392 0;0.823529422283173 0.484313726425171 0;0.811764717102051 0.48284313082695 0;0.800000011920929 0.481372535228729 0;0.788235306739807 0.479901969432831 0;0.776470601558685 0.47843137383461 0;0.764705896377563 0.476960778236389 0;0.752941191196442 0.475490212440491 0;0.74117648601532 0.47401961684227 0;0.729411780834198 0.472549021244049 0;0.717647075653076 0.471078425645828 0;0.705882370471954 0.469607830047607 0;0.694117665290833 0.468137264251709 0;0.682352960109711 0.466666668653488 0;0.671078443527222 0.468872547149658 0.0313725508749485;0.659803926944733 0.471078425645828 0.062745101749897;0.648529410362244 0.473284333944321 0.0941176563501358;0.637254953384399 0.475490212440491 0.125490203499794;0.62598043680191 0.477696090936661 0.156862750649452;0.614705920219421 0.479901969432831 0.188235312700272;0.603431403636932 0.482107847929001 0.21960785984993;0.592156887054443 0.484313726425171 0.250980406999588;0.580882370471954 0.486519634723663 0.282352954149246;0.569607853889465 0.488725513219833 0.313725501298904;0.558333337306976 0.490931391716003 0.345098048448563;0.547058820724487 0.493137270212173 0.376470625400543;0.535784363746643 0.495343148708344 0.407843172550201;0.524509847164154 0.497549057006836 0.43921571969986;0.513235330581665 0.499754935503006 0.470588266849518;0.501960813999176 0.501960813999176 0.501960813999176;0.43921571969986 0.43921571969986 0.43921571969986;0.376470625400543 0.376470625400543 0.376470625400543;0.313725501298904 0.313725501298904 0.313725501298904;0.250980406999588 0.250980406999588 0.250980406999588;0.188235312700272 0.188235312700272 0.188235312700272;0.125490203499794 0.125490203499794 0.125490203499794;0.062745101749897 0.062745101749897 0.062745101749897;0 0 0]); | |
% Create axes | |
axes1 = axes('Parent',figure1,'YTick',zeros(1,0),'YDir','reverse',... | |
'XTick',zeros(1,0),...... | |
'Position',[0.0954107520333119 0.0668345743049818 0.883942766295707 0.920469361147327],... | |
'Layer','top',... | |
'FontSize',16,... | |
'FontName','DejaVu Sans Mono'); | |
% preserve the X-limits of the axes | |
%xlim(axes1,[0.5 8.5]); | |
% preserve the Y-limits of the axes | |
%ylim(axes1,[0.5 12.5]); | |
hold(axes1,'all'); | |
% Create image | |
image(calld,'Parent',axes1,'CDataMapping','scaled'); | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%%% Matlab hopf | |
%%%%%%%%%%%%%%%%%%%%%%%%%% | |
net = newhop(data); | |
[Y,Pf,Af] = sim(net,360,[],data); | |
W= net.LW{1,1}; | |
alld=[]; | |
space=2; | |
for p=1:360 | |
otv=[]; | |
ot=Y(:,p); | |
for n=1:96 | |
otv(floor((n-1)/8)+1,mod(n-1,8)+1)=ot(n); | |
end | |
x=mod(p-1,30)*space; | |
y=floor((p-1)/30)*space; | |
a=floor((p-1)/30)*12+1+y:(floor((p-1)/30)+1)*12+y; | |
b=x+mod(p-1,30)*8+1:x+(mod(p-1,30)+1)*8; | |
alld(a, b)=otv; | |
end | |
% Create figure | |
figure1 = figure('PaperSize',[20.98404194812 29.67743169791],... | |
'Colormap',[1 1 1;1 1 0.857142865657806;1 1 0.714285731315613;1 1 0.571428596973419;1 1 0.428571432828903;1 1 0.28571429848671;1 1 0.142857149243355;1 1 0;0.991911768913269 0.968137264251709 0;0.983823537826538 0.936274528503418 0;0.975735306739807 0.904411792755127 0;0.967647075653076 0.872548997402191 0;0.959558844566345 0.8406862616539 0;0.951470613479614 0.808823525905609 0;0.943382382392883 0.776960790157318 0;0.935294151306152 0.745098054409027 0;0.927205860614777 0.713235318660736 0;0.919117629528046 0.6813725233078 0;0.911029398441315 0.649509787559509 0;0.902941167354584 0.617647051811218 0;0.894852936267853 0.585784316062927 0;0.886764705181122 0.553921580314636 0;0.878676474094391 0.522058844566345 0;0.87058824300766 0.490196079015732 0;0.858823537826538 0.488725483417511 0;0.847058832645416 0.487254917621613 0;0.835294127464294 0.485784322023392 0;0.823529422283173 0.484313726425171 0;0.811764717102051 0.48284313082695 0;0.800000011920929 0.481372535228729 0;0.788235306739807 0.479901969432831 0;0.776470601558685 0.47843137383461 0;0.764705896377563 0.476960778236389 0;0.752941191196442 0.475490212440491 0;0.74117648601532 0.47401961684227 0;0.729411780834198 0.472549021244049 0;0.717647075653076 0.471078425645828 0;0.705882370471954 0.469607830047607 0;0.694117665290833 0.468137264251709 0;0.682352960109711 0.466666668653488 0;0.671078443527222 0.468872547149658 0.0313725508749485;0.659803926944733 0.471078425645828 0.062745101749897;0.648529410362244 0.473284333944321 0.0941176563501358;0.637254953384399 0.475490212440491 0.125490203499794;0.62598043680191 0.477696090936661 0.156862750649452;0.614705920219421 0.479901969432831 0.188235312700272;0.603431403636932 0.482107847929001 0.21960785984993;0.592156887054443 0.484313726425171 0.250980406999588;0.580882370471954 0.486519634723663 0.282352954149246;0.569607853889465 0.488725513219833 0.313725501298904;0.558333337306976 0.490931391716003 0.345098048448563;0.547058820724487 0.493137270212173 0.376470625400543;0.535784363746643 0.495343148708344 0.407843172550201;0.524509847164154 0.497549057006836 0.43921571969986;0.513235330581665 0.499754935503006 0.470588266849518;0.501960813999176 0.501960813999176 0.501960813999176;0.43921571969986 0.43921571969986 0.43921571969986;0.376470625400543 0.376470625400543 0.376470625400543;0.313725501298904 0.313725501298904 0.313725501298904;0.250980406999588 0.250980406999588 0.250980406999588;0.188235312700272 0.188235312700272 0.188235312700272;0.125490203499794 0.125490203499794 0.125490203499794;0.062745101749897 0.062745101749897 0.062745101749897;0 0 0]); | |
% Create axes | |
axes1 = axes('Parent',figure1,'YTickLabel',{'2','4','6','8','10','12'},... | |
'YTick',[2.5 4.5 6.5 8.5 10.5 12.5],... | |
'YGrid','on',... | |
'YDir','reverse',... | |
'XTickLabel',{'2','4','6','8'},... | |
'XTick',[2.5 4.5 6.5 8.5],... | |
'XGrid','on',... | |
'Position',[0.0954107520333119 0.0668345743049818 0.883942766295707 0.920469361147327],... | |
'Layer','top',... | |
'FontSize',16,... | |
'FontName','DejaVu Sans Mono'); | |
% preserve the X-limits of the axes | |
xlim(axes1,[0.5 8.5]); | |
% preserve the Y-limits of the axes | |
ylim(axes1,[0.5 12.5]); | |
box(axes1,'on'); | |
hold(axes1,'all'); | |
% Create image | |
image(alld,'Parent',axes1,'CDataMapping','scaled'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[S,Q] = size(t); | |
W=zeros(S); | |
W = W + (2/3)*t(:,1)*t(:,1)'; | |
W = W + (1/6)*t(:,2)*t(:,2)'; | |
W = W + (1/6)*t(:,3)*t(:,3)'; | |
for k=1:S | |
W(k,k)=0; | |
end | |
CY=[]; | |
for k=1:Q | |
u=t(:,k); | |
while( norm(satlins(W*u)-u)>0 ) | |
u=satlins(W*u); | |
end | |
CY=[CY u]; | |
end | |
alld=[]; | |
space=2; | |
for p=1:Q | |
otv=[]; | |
ot=CY(:,p); | |
for n=1:S | |
otv(floor((n-1)/8)+1,mod(n-1,8)+1)=ot(n); | |
end | |
x=mod(p-1,30)*space; | |
y=floor((p-1)/30)*space; | |
a=floor((p-1)/30)*6+1+y:(floor((p-1)/30)+1)*6+y; | |
b=x+mod(p-1,30)*8+1:x+(mod(p-1,30)+1)*8; | |
alld(a, b)=otv; | |
end | |
% Create figure | |
figure1 = figure('PaperSize',[20.98404194812 29.67743169791],... | |
'Colormap',[1 1 1;1 1 0.857142865657806;1 1 0.714285731315613;1 1 0.571428596973419;1 1 0.428571432828903;1 1 0.28571429848671;1 1 0.142857149243355;1 1 0;0.991911768913269 0.968137264251709 0;0.983823537826538 0.936274528503418 0;0.975735306739807 0.904411792755127 0;0.967647075653076 0.872548997402191 0;0.959558844566345 0.8406862616539 0;0.951470613479614 0.808823525905609 0;0.943382382392883 0.776960790157318 0;0.935294151306152 0.745098054409027 0;0.927205860614777 0.713235318660736 0;0.919117629528046 0.6813725233078 0;0.911029398441315 0.649509787559509 0;0.902941167354584 0.617647051811218 0;0.894852936267853 0.585784316062927 0;0.886764705181122 0.553921580314636 0;0.878676474094391 0.522058844566345 0;0.87058824300766 0.490196079015732 0;0.858823537826538 0.488725483417511 0;0.847058832645416 0.487254917621613 0;0.835294127464294 0.485784322023392 0;0.823529422283173 0.484313726425171 0;0.811764717102051 0.48284313082695 0;0.800000011920929 0.481372535228729 0;0.788235306739807 0.479901969432831 0;0.776470601558685 0.47843137383461 0;0.764705896377563 0.476960778236389 0;0.752941191196442 0.475490212440491 0;0.74117648601532 0.47401961684227 0;0.729411780834198 0.472549021244049 0;0.717647075653076 0.471078425645828 0;0.705882370471954 0.469607830047607 0;0.694117665290833 0.468137264251709 0;0.682352960109711 0.466666668653488 0;0.671078443527222 0.468872547149658 0.0313725508749485;0.659803926944733 0.471078425645828 0.062745101749897;0.648529410362244 0.473284333944321 0.0941176563501358;0.637254953384399 0.475490212440491 0.125490203499794;0.62598043680191 0.477696090936661 0.156862750649452;0.614705920219421 0.479901969432831 0.188235312700272;0.603431403636932 0.482107847929001 0.21960785984993;0.592156887054443 0.484313726425171 0.250980406999588;0.580882370471954 0.486519634723663 0.282352954149246;0.569607853889465 0.488725513219833 0.313725501298904;0.558333337306976 0.490931391716003 0.345098048448563;0.547058820724487 0.493137270212173 0.376470625400543;0.535784363746643 0.495343148708344 0.407843172550201;0.524509847164154 0.497549057006836 0.43921571969986;0.513235330581665 0.499754935503006 0.470588266849518;0.501960813999176 0.501960813999176 0.501960813999176;0.43921571969986 0.43921571969986 0.43921571969986;0.376470625400543 0.376470625400543 0.376470625400543;0.313725501298904 0.313725501298904 0.313725501298904;0.250980406999588 0.250980406999588 0.250980406999588;0.188235312700272 0.188235312700272 0.188235312700272;0.125490203499794 0.125490203499794 0.125490203499794;0.062745101749897 0.062745101749897 0.062745101749897;0 0 0]); | |
% Create axes | |
axes1 = axes('Parent',figure1,'YTickLabel',{'2','4','6','8','10','12'},... | |
'YTick',[2.5 4.5 6.5 8.5 10.5 12.5],... | |
'YGrid','on',... | |
'YDir','reverse',... | |
'XTickLabel',{'2','4','6','8'},... | |
'XTick',[2.5 4.5 6.5 8.5],... | |
'XGrid','on',... | |
'Position',[0.0954107520333119 0.0668345743049818 0.883942766295707 0.920469361147327],... | |
'Layer','top',... | |
'FontSize',16,... | |
'FontName','DejaVu Sans Mono'); | |
box(axes1,'on'); | |
hold(axes1,'all'); | |
% Create image | |
image(alld,'Parent',axes1,'CDataMapping','scaled'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment