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.

53 lines
1.6 KiB
Matlab

function words_plot_results(x,y,r,alpha)
ymax=4;
nLetters=36;
for l=1:4
%draw input letters
%maxsubplot(3,8,2*l-1,0.3)
subplot(6,4,16+l)
letter=x(1+(l-1)*14:l*14);
draw_letter(letter);
set(gca,'Box','off');
%draw reconstructed input
%maxsubplot(3,8,2*l,0.3)
%subplot(5,8,24+2*l)
%letter=r{1}(1+(l-1)*14:l*14);
%draw_letter(letter);
%set(gca,'Box','off');
%plot responses of all letter detecting neurons
%maxsubplot(3,4,4+l,0.3)
subplot(3,4,4+l)
yLetter=y{1}(1+(l-1)*nLetters:l*nLetters-1);
plot(yLetter,'r');
axis([0,nLetters,0,ymax])
[m,ind]=sort(yLetter,'descend');
val=ind;
val(ind<=26)=val(ind<=26)+96;%ascii codes for letters
val(ind>26)=val(ind>26)+48-27;%ascii codes for numbers
numToLabel=length(find(m>0.25*m(1)));
for i=1:numToLabel, text('Position',[ind(i),min(ymax,m(i))],'String',char(val(i)),'HorizontalAlignment','center','VerticalAlignment','Bottom','FontSize',20,'FontWeight','bold'); end
if l>1, set(gca,'YTick',[]); end
set(gca,'XTick',[],'FontSize',16);
end
%plot responses of all word detecting neurons
%maxsubplot(3,1,3,0.15)
%ymax=2
subplot(3,1,1)
plot(y{2},'r')
axis([0,length(alpha)+1,0,ymax])
[m,ind]=sort(y{2},'descend');
if ind(1)>ind(2),
align{1}='left'; align{2}='center';
else
align{2}='left'; align{1}='center';
end
numToLabel=length(find(m>0.25*m(1) & m>0.5));
for i=1:numToLabel, text('Position',[ind(i),min(ymax,m(i))],'String',alpha{ind(i)},'HorizontalAlignment',align{1+mod(i+1,2)},'VerticalAlignment','Bottom','FontSize',20);end
set(gca,'XTick',[],'FontSize',16);
cmap=colormap('gray');cmap=1-cmap;colormap(cmap);
set(gcf,'PaperSize',[15.6 12],'PaperPosition',[0 0 15.6 12]);