Hello
I would need some help for fitting my data. Let's assume that I want to fit data registred in the matrix "spe":
x=spe(N,1)y=spe(N,2)
and that it should be fitted by a Gaussian function
I have defined the matlab function for the Gaussian :
function fun = gauss(b1,b2,b3,x) fun = b3 * (1/(b1*sqrt(2*pi))) * exp(-(x-b2).^2/(2*(b1).^2));end
and then, I want to use this function to fit my spe data using this expression in my main program using the nlinfit function.
As far as I understood, I have to create a function handle, which, by the way I am not understanding exactly what it is, in order to use nlinfit :
I tried :
mdl = @gaussb0 = [1 1480 500];b = nlinfit(spe(:,1), spe(:,2), mdlgausstest,b0);
but it is returning some error message.
Could you help me? Thank you very much !!
Best Answer