Applying the Nonlinear Least Squares Method to Minimize the Objective Function to Find the Parameters of the Equation

3 views (last 30 days)
yu zhang
yu zhang on 4 Jul 2022
Edited: yu zhang on 5 Jul 2022
The liquid-liquid equilibrium data were fitted using the NRTL equation. The equation parameters of NRTL are derived from the experimental data.
below is my code:
clc,clear
options=optimset('MaxIter',4000,'MaxFunEvals',2000000,'algorithm','levenberg-marquardt');
b0=[0,0,0,0,0,0];
[b,gamma1,gamma2,gamma3,gamma4,gamma5,gamma6]=lsqnonlin('NRTL',b0,[],[],options);
Although the code gives the result, the result is not what I want. And the format of the output gamma is also wrong. It should be a matrix of the same order as x1, but it has become something I don't understand. Can someone please give a reason? It would be best to give some solutions. Thanks!

Accepted Answer

Matt J
Matt J on 4 Jul 2022
Edited: Matt J on 4 Jul 2022
Your code makes strange assumptions about the output syntax of lsqnonlin.
Why do you think lsqnonlin will return values for the gamma variables in NRTL?
  6 Comments
Matt J
Matt J on 4 Jul 2022
Do you have any other suggestions?
@yu zhang I suggest you Acccept-click this answer, since your original question appears to have been resolved.
Since you have a new question and since it is related to code different from this question, I suggest you post that in a new thread.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!