How to carry out lease square fitting?

1 次查看(过去 30 天)
Hi, I am attempting to fit data that should fit the following function:
F =1i*x(1)+1i*(x(2)-x(1))./(1+(1i*2*pi*freq*x(3))).^(1-x(4))-1i*xdata
x(1:4) are the constants that needs to be optimizeed and omega (2*pi*freq) is the variable for the function. I have xdata and ydata for each freq value.
Following is the code I written but it gives Solver stopped prematurely.
freq = 100:100:1000; Rdata=[500 800 1000 2000 3500 5000 7500 10000 11000 12000]; Idata = [300 600 900 1500 2000 1800 1200 800 500 200]; plot(Rdata,Idata,'ro') F = @(x,xdata)1i*x(1)+1i*(x(2)-x(1))./(1+(1i*2*pi*freq*x(3))).^(1-x(4))-1i*xdata; x0 = [1 1 1 0]; [x,resnorm,~,exitflag,output] = lsqcurvefit(F,x0,Rdata,Idata); plot(Rdata,F(x,Rdata))
Could you please help me in solving this problem.

采纳的回答

Star Strider
Star Strider 2014-5-8
If the solver stopped prematurely, it means that it reached the limit of function evaluations or iterations before it minimised the function. Use the optimoptions function to increase the number of function evaluations, iterations, or whatever lsqcurvefit asks you to increase. This is not an error but a suggestion.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by