

[fitcoeffs,errS] = polyfit(avgrain([1,2,4,5,6,7,8]),aaediff_perc([1,2,4,5,6,7,8]),1);
fitvals = polyval(fitcoeffs,avgrain([1,2,4,5,6,7,8]));

corrmat = corrcoef(aaediff_perc([1,2,4,5,6,7,8]),fitvals);

r2 = corrmat(1,2).^2;

figure; 
maxfig(gcf,1);


plot(avgrain([1,2,4,5,6,7,8]),aaediff_perc([1,2,4,5,6,7,8]),'Marker','.','MarkerSize',50,'LineStyle','none');
set(gca,'FontWeight','bold','FontSize',30,'XLim',[0,10.1],'XTick',[2,4,6,8,10],'YLim',[0,100],'YTick',[20,40,60,80,100]);
xlabel('Mean Precipitation Rate (mm/hr)');
ylabel('Percent Change in AAE');
axis square;
hold on;

plot(avgrain([1,2,4,5,6,7,8]),fitvals,'k');


