How to use lsqnonlin command.

1 回表示 (過去 30 日間)
Geeniee
Geeniee 2021 年 4 月 26 日
編集済み: Matt J 2021 年 4 月 26 日
I am supposed to use lsqnonlin to solve the least squares problem:
.
Please comment on my code.
%data
T = [126; 125; 123; 120; 119; 118; 116; 115; 114; 113; 112; 111; 110];
t = [4; 5; 7; 12; 14; 16; 20; 24; 28; 31; 34; 37.5; 41];
T0 = 126; Tomg = 60;
beta0 = 139.6242; %Found beta0 by linearizing problem using log functions
fun = @(b)T-(Tomg+(T0-Tomg)*exp(-b*t));
beta = lsqnonlin(fun,beta0);

回答 (1 件)

Matt J
Matt J 2021 年 4 月 26 日
編集済み: Matt J 2021 年 4 月 26 日
Please comment on my code.
It's fine, but lsqcurvefit is often more convenient for curve fitting problems, e.g. if you want to plot the resulting fit.

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by