# How to get positive kla(mass transfer coefficient) by solving ODE's using ode 15s and lsqonlin function?

조회 수: 2 (최근 30일)
Mohankumar Narayanasamy 2021년 9월 24일
답변: Kumar Pallav 2021년 9월 27일
[klaFit, resnorm, residual,~,optOut,lambda,J] = lsqnonlin(residualFun,...
0.5,[ ],[ ],lsqOpts);
The kla value after iterating returns a negative value from lsqonlin function. Could some one explain this or help getting a positive value?

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

### 답변 (1개)

Kumar Pallav 2021년 9월 27일
From my understanding, 'lsqnonlin' solves nonlinear least-squares (nonlinear data-fitting) problems.
x = lsqnonlin(fun,x0) starts at the point x0 and finds a minimum of the sum of squares of the functions described in fun.
Here, you have given the initial point as 0.5, and the solution you get is negative, that means, your function (residualFun) sum of squares is minimized at that negative value.
You can try the following format so that the solution is always in the range lb ≤ x ≤ ub,
x = lsqnonlin(fun,x0,lb,ub,options)
where 'lb' and 'ub' are lower and upper bounds respectively.
Refer this for more on 'lsqnonlin' function.

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

### 카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by