%plotit.m
%plot results from workspace generated via mle.m
timeline=[0:0.1:20];
%best-fit power function
p_power = w1(1,1) * timeline.^(-w1(2,1));
%best-fit exponential function
p_expo = w2(1,1) * exp(-w2(2,1)*timeline);
figure(1), clf;
plot(timeline,p_power,'b');
hold on;
plot(timeline, p_expo,'g');
axis([0 20 0 1.0]);
scatter(t,y,'filled');
xlabel('Retention Time (sec)');
ylabel('Proportion Correct Recall');
legend('Power model','Exponential model','Location','NorthEast');
tstr(1)={'MLE-Based Best-Fit Memory Retention Functions'};
tstr(2)={'(see Figure 4 from Myung(2003) Max Likelihood Tutorial)'};
title(tstr);
str1=sprintf('power: w1=%05.3f, w2=%05.3f, r-squared=%04.2f', w1(1,1), w1(2,1),r2(1,1));
text(6.4,0.8,str1);
str2=sprintf('exponential: w1=%05.3f, w2=%05.3f, r-squared=%04.2f', w2(1,1), w2(2,1),r2(2,1));
text(5.0,0.75,str2);
hold off;
