123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- function ff=do_plot(bins,aux,col,col2)
- % aux=aux/max(aux);
- %
- % sel=bins>0.015 & bins<0.3;
- %
- %
- % fo = fitoptions('Method','NonlinearLeastSquares',...
- % 'Lower',[0.2,0,0,0,6,-1,-1],...
- % 'Upper',[2,20,1,Inf,12,1,1],...
- % 'StartPoint',[1,3,.2,10,8,0,0]);
- % % ft = fittype('a-b*x+c*cos(2*pi*f*x)*exp(-d*x)','options',fo);
- % ft = fittype('a*exp(-b*x)+c*cos(2*pi*f*x)*exp(-d*x)+g+h*x','options',fo);
- % aux=aux/max(aux);
- [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);
- plot(bins,curve2.a*exp(-curve2.b*bins)+curve2.g+curve2.h*bins,'c');
- 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(curve2.f);
- % curve2
- % gof2
- disp(['freq: ' trunc(curve2.f,3) ' R^{2}: ' trunc(gof2.rsquare,3)]);
- ff=curve2.f;
- axis([0 .3 -.2 .2])
- % plot(bins,.2+.9*exp(-6*bins).*(1+.1*cos(2*pi*bins*9)),'b');
|