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.
107 lines
3.5 KiB
Matlab
107 lines
3.5 KiB
Matlab
function words_perceptual_advantage_asynconset8()
|
|
incFeedback=1;
|
|
close all
|
|
|
|
%define network
|
|
[W,alpha,mImage,nLetters]=words_weights(incFeedback);
|
|
|
|
%define input patterns
|
|
wordcontext=zeros(mImage,1);
|
|
wordcontext([encode_letter('w'),encode_letter('o'),logical(zeros(1,14)),encode_letter('d')])=1;%WO_D
|
|
letter1=zeros(mImage,1);
|
|
letter1([logical(zeros(1,28)),encode_letter('r'),logical(zeros(1,14))])=1; %__R_
|
|
nonwordcontext=zeros(mImage,1);
|
|
nonwordcontext([encode_letter('o'),encode_letter('w'),logical(zeros(1,14)),encode_letter('r')])=1;%OW_R
|
|
letter2=zeros(mImage,1);
|
|
letter2([logical(zeros(1,28)),encode_letter('d'),logical(zeros(1,14))])=1; %__D_
|
|
|
|
offset=75;
|
|
onset=ceil((1+(2-1)*offset)/2);
|
|
ratios=[1,2];
|
|
X=zeros(mImage,offset+1,4);%X is three-dimensional, to allow for time-varying stimulus
|
|
|
|
%define images with normal word context
|
|
k=0;
|
|
for r=ratios
|
|
k=k+1;
|
|
for t=onset:offset
|
|
X(:,t,k)=letter1;
|
|
end
|
|
for t=fix(offset-r*(offset-onset)):offset
|
|
X(:,t,k)=X(:,t,k)+wordcontext;
|
|
end
|
|
end
|
|
%define images with nonword context
|
|
for r=ratios
|
|
k=k+1;
|
|
for t=onset:offset
|
|
X(:,t,k)=letter2;
|
|
end
|
|
for t=fix(offset-r*(offset-onset)):offset
|
|
X(:,t,k)=X(:,t,k)+nonwordcontext;
|
|
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,offset);
|
|
if k<=2
|
|
resp(k,:)=yTrace{1}(2*nLetters+18,:); %record response of node selective for letter "r" in 3rd position
|
|
else
|
|
resp(k,:)=yTrace{1}(2*nLetters+4,:); %record response of node selective for letter "d" in 3rd position
|
|
end
|
|
|
|
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
|
|
|
|
figure(5),clf
|
|
plot(resp','LineWidth',2),axis([0,offset,0,5])
|
|
legend(['blank '
|
|
'word context ';
|
|
'blank ';
|
|
'pseudo context '],'Location','Best')
|
|
set(gca,'FontSize',15);
|
|
xlabel('time'),ylabel('activation')
|
|
set(gcf,'PaperSize',[18 12],'PaperPosition',[0 0 18 12]);
|
|
|
|
|
|
|
|
human=[83,87,64.3,66];
|
|
|
|
|
|
figure(6),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(1:2),ratios,human(1:2));
|
|
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.5,2.5,0.4,3]);
|
|
axis(hAx(2),[0.5,2.5,62,92]);
|
|
set(hAx(1),'FontSize',12);set(hAx(1),'XColor','k','YColor',cm)
|
|
set(hAx(2),'FontSize',12);set(hAx(2),'XColor','k','YColor',ch)
|
|
set(hAx(1),'XTick',[],'YTick',[]),
|
|
set(hAx(2),'XTick',[],'YTick',[])
|
|
|
|
|
|
hold on
|
|
[hAx,hLine1,hLine2] = plotyy(ratios,respMean(3:4),ratios,human(3:4));
|
|
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.5,2.5,0.4,3]);
|
|
axis(hAx(2),[0.5,2.5,62,92]);
|
|
set(hAx(1),'FontSize',12);set(hAx(1),'XColor','k','YColor',cm)
|
|
set(hAx(2),'FontSize',12);set(hAx(2),'XColor','k','YColor',ch)
|
|
set(hAx(1),'XTick',[],'YTick',[0:0.5:4])
|
|
set(hAx(2),'XTick',ratios,'YTick',[60:10:90]),
|
|
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_asynconset8.pdf')
|
|
|