You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Cognition/words_perceptual_advantage_...

63 lines
2.1 KiB
Matlab

function words_perceptual_advantage_asynconset1()
incFeedback=1;
close all
%define network
[W,alpha,mImage,nLetters]=words_weights(incFeedback);
%define input patterns
context=zeros(mImage,1);
context([encode_letter('k'),encode_letter('n'),logical(zeros(1,14)),encode_letter('t')])=1;%KN_T
letter=zeros(mImage,1);
letter([logical(zeros(1,28)),encode_letter('i'),logical(zeros(1,14))])=1; %__I_
offset=75;
onset=ceil((1+(2-1)*offset)/2);
ratios=[0.6,0.75,1,1.33,1.67];
X=zeros(mImage,offset+1,5);%X is three-dimensional, to allow for time-varying stimulus
k=0;
for r=ratios
k=k+1;
for t=onset:offset
X(:,t,k)=letter;
end
for t=fix(offset-r*(offset-onset)):offset
X(:,t,k)=X(:,t,k)+context;
end
end
%present each input to the network in turn and record the results
for k=1:size(X,3)
x=X(:,:,k);
[y,e,r,yTrace]=dim_activation_hierarchical(W,x,incFeedback);
resp(k,:)=yTrace{1}(2*nLetters+9,:); %record response of node selective for letter i in 3rd position
respMean(k)=mean(resp(k,:));
figure(k),clf, words_plot_results(x,y,r,alpha);
c=0; for t=1:ceil(size(X,2)/8):size(X,2), for l=1:4, c=c+1; subplot(22,4,56+c), letter=X(1+(l-1)*14:l*14,t,k);draw_letter(letter);end,end
end
human=[64.5,67,73,78,80];
figure(7),clf
axes('Position',[0.2,0.2,0.6,0.6]),
cm='r';
ch=[0.5,0,0.5];
[hAx,hLine1,hLine2] = plotyy(ratios,respMean',ratios,human,'semilogx');
set(hLine1,'LineStyle','-','Color',cm,'Marker','o','LineWidth',2,'MarkerFaceColor',cm)
set(hLine2,'LineStyle','-','Color',ch,'Marker','s','LineWidth',2,'MarkerFaceColor',ch)
axis(hAx(1),[0.55,1.8,1.2,2.1]);
axis(hAx(2),[0.55,1.8,62,82]);
set(hAx(1),'XTick',[],'YTick',[0:0.2:4]),
set(hAx(2),'XTick',ratios,'YTick',[60:10:90])
set(hAx(1),'FontSize',12);set(hAx(1),'XColor','k','YColor',cm)
set(hAx(2),'FontSize',12);set(hAx(2),'XColor','k','YColor',ch)
xlabel(hAx(2),'relative duration'),
ylabel(hAx(1),'mean activation','Color',cm,'FontSize',12),
ylabel(hAx(2),'% correct','Color',ch,'FontSize',12)
set(gcf,'PaperSize',[8 7],'PaperPosition',[0 0 8 8]);
print(gcf, '-dpdf', 'words_perceptual_advantage_asynconset1.pdf')