How can I implement lsqcurvefit function on my equations?

조회 수: 3 (최근 30일)
Ceyhan TURKMEN
Ceyhan TURKMEN 2020년 10월 12일
댓글: Jon 2020년 10월 12일
Hello, I have a nonlinear equation system of 5 variables (complex-valued) and I want to try “lsqcurvefit” function. I want my output to be as close to zero as possible so, should "ydata" must be equal to my expected values or a row vector of 5 zeros? Sorry if it's a dumb question but I am confused. Thanks for the help.
objfcn = @(x,xdata) [...Equations...];
x0 = Initial_Values(1,:)';
xdata = Measurements(1,:)';
ydata = Exp_XValues(1,:)';
[x,fval] = lsqcurvefit(objfcn, x0, xdata, ydata, [], []);
  댓글 수: 2
Matt J
Matt J 2020년 10월 12일
You mean you want the x(i) to be as close to zero as possible? You think the optimal parameters are non-unique?
Ceyhan TURKMEN
Ceyhan TURKMEN 2020년 10월 12일
Actually, I search optimum x(i) values, whose roots of the equation set.

댓글을 달려면 로그인하십시오.

채택된 답변

Jon
Jon 2020년 10월 12일
편집: Jon 2020년 10월 12일
From your description, it sound like you want to find the solution to a system of 5 equations (in I assume 5 unknowns). In this case I think fsolve would be more appropriate. lsqcurvefit is for the situation where you are trying to find the coefficients of a nonlinear expression to give the best fit to an observed data set. In particular this would be the situation where you have typically many more equations than unknowns, and your unknowns are the parameters of some nonlinear equation. So for example if you were trying to fit an equation y = a*x^b + c and you wanted to find the best values for a,b and c.
  댓글 수: 2
Ceyhan TURKMEN
Ceyhan TURKMEN 2020년 10월 12일
Thank you for your answer. It seems like fsolve is more suitable for this problem as you said. I will applied fsolve to solve the equations.
Jon
Jon 2020년 10월 12일
Glad to hear you are able to move ahead now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by