function ff=do_plot(bins,aux,col,col2) [curve2, ~] = do_fit(bins,aux); aux=aux/feval(curve2,0); [curve2, gof2] = do_fit(bins,aux); subplot(2,2,1) p1=plot(curve2); set(p1,'Color',col2,'LineWidth',2); hold on; plot(bins,aux,'Color',col); legend off; axis([0 .3 0 1.2]) subplot(2,2,2) plot(bins,curve2.c.*cos(2*pi*curve2.f.*bins).*exp(-curve2.d.*bins),'Color',col2,'LineWidth',2); hold on; plot(bins,aux-feval(curve2,bins)'+curve2.c.*cos(2*pi*curve2.f.*bins).*exp(-curve2.d.*bins),'Color',col); disp(['freq: ' trunc(curve2.f,3) ' R^{2}: ' trunc(gof2.rsquare,3)]); ff=curve2.f; axis([0 .3 -.2 .2])