%In physics, a three-parameter Lorentzian function is often used, as follows: % f(x;x0,?,I) = I/(1 + ( (x-x0)/? )^2) % I: is the height of the peak. % x0: is the location paremeter, specifying the location of the peak. % ?: is the scale parameter which specifies the half-width at half-maximum (HWHM). % ? is also equal to half the interquartile range and is sometimes called the probable error. %If you would want,e. g., to ?t a Lorentzian y = a1/((x ? a2)^2 + a3) to a data set Xi, Yi, %you should define in MATLAB a function resulting in the sum of the squared residuals % a(1)= I % a(2)= x0 % a(3)= ? function chisq = SupGau_devsum(a,X,Y) %a % a(1) = sigma_0 % a(2) = N; % a(3) = x0 %SupGau = a(4)+1/(sqrt(2*pi)*a(1))*exp(-abs(X-a(3)).^a(2)/(2*a(1).^a(2)));% super gaussian % a(1) = base % a(2) = A; amplitude % a(3) = x0; center % a(4) = D; sigma_0 % a(5) = N; SupGau = a(1)+a(2)*exp( -0.5*(abs(X-a(3))/(a(4))).^a(5) ); % super gaussian %X' csq = (Y - SupGau).^2; chisq = sum(csq); %csq %chisq return