Curve fitting with a custom equation

45 ビュー (過去 30 日間)
Marco Sette
Marco Sette 2025 年 10 月 10 日 16:42
回答済み: Marco Sette 2025 年 10 月 11 日 6:42
Hi all,
I'm trying to fit a custom equation but it seems I wrote not in the correct way or somethinkg similar (I'm quite new to Matlab)...
The equation is
u+(f-u)/(1+exp((-H/1.9872)*(1/x-1/m)+(C/1.9872)*[((m/x)-1)+log(x/m)]))
and the error message claims
Fit Name: untitled fit 1
Error: Expression u+(f-u)/(1+exp((-H/1.9872)*(1/x-1/m)+(C/1.9872)*[((m/.x)-1)+log(x/m)])) is not a valid MATLAB expression, has non-scalar coefficients, or cannot be evaluated:
Error in fittype expression ==> u+(f-u)./(1+exp((-H./1.9872).*(1./x-1./m)+(C./1.9872).*[((m./.x)-1)+log(x./m)]))
??? Invalid use of operator.
Do you have suggestions?
Thanks
Marco

回答 (2 件)

Torsten
Torsten 2025 年 10 月 10 日 17:03
Only round brackets are allowed in your expression. But maybe there are additional problems.
If the code does not work after replacing [ ] by ( ), you should post your MATLAB code for inspection.
  6 件のコメント
Marco Sette
Marco Sette 2025 年 10 月 10 日 21:25
編集済み: Marco Sette 2025 年 10 月 10 日 21:27
Hi Torsten,
x values range from 293 to 363 K.
I will check tomorrow the procedure you suggest.
Many thanks
Marco
Torsten
Torsten 2025 年 10 月 10 日 22:30
In your fittype expression, there is another error:
m/.x
should be replaced by
m./x
or at least
m/x

サインインしてコメントする。


Marco Sette
Marco Sette 2025 年 10 月 11 日 6:42
Hi all,
it seems to work now. I've simply rewritten the equation without differences...
The script is attached.
The results are similar to the published ones (this is a test similar to literature).
I need to adjust some parameters but it seems I'm on the right way..
Thanks a lot for your kind help, it was very useful :)
Best
Marco

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by