data fitting to equation
2 ビュー (過去 30 日間)
古いコメントを表示
I have data for time(t) and pressure (p).
I want to fit these data to equation
I have done simple calcualtion and fittings in matlab. plese suggest how to fit data.
12 件のコメント
回答 (1 件)
Just Manuel
2021 年 2 月 24 日
Refer to this answer from Star Strider:
You can fit any function using simple least squares regression. Just formulate your function (i guess you have already done that) in matlab, then make a cost function (least squares) and use fminsearch to optimize parameters c1 and c2
P = @(c, t) ... % your function
cost = @(c) sum((P(c,t) - p).^2);
% guess initial parameters
c_guess = [1 1];
% use fminsearch
c = fminsearch(cost, guess);
Cheers
Manuel
2 件のコメント
Walter Roberson
2023 年 1 月 10 日
Your code 2 1/2 years ago did not involve fmincon at all, so we cannot guess what your current code looks like.
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!