fit using lsqcurvefit
问题 I want to fit some data to a lorentz function but I figure problems with fitting when I use parameters which are of different orders of magnitude. This my lorentz function: function [ value ] = lorentz( x,x0,gamma,amp ) value = amp * gamma^2 ./ ((x-x0).^2 + gamma^2); end Now the script to generate sample data: x = linspace(2e14,6e14,200); x0 = 4.525e14; gamma = 0.5e14; amp = 2e-14; y = lorentz(x,x0,gamma,amp); And the script for fitting lorentz to the sample data: params = [4.475e14;0.4e14;1