fitSingleZero.m 655 B

12345678910111213141516171819202122232425262728
  1. function fv=fitSingleZero(globalPar, cax)
  2. %par is a nfunc x npar matrix of coefficients
  3. %globalPar is a row vector of global coefficients
  4. %cax is a column vector of time instances
  5. %cay are the function values
  6. %oneVector=ones(1,size(cax,1));%column vector
  7. A=globalPar(1);
  8. tau=globalPar(2);
  9. alpha=globalPar(3);
  10. dt=globalPar(4);
  11. cax1=cax-dt;
  12. if tau==1/alpha
  13. fv=cax1.*exp(-cax1/tau);
  14. else
  15. fv=tau*(exp(-alpha*cax1)-exp(-cax1/tau))/(1-alpha*tau);
  16. end
  17. fv=fv*A;
  18. sel=cax1<0;
  19. fv(sel)=0;
  20. %fv=A*power(cax,alpha).*exp(-cax/tau)/power(tau,alpha);
  21. end
  22. %par=ones(2,