Complementary error function curve fitting

87 ビュー (過去 30 日間)
Nachiketa
Nachiketa 2014 年 8 月 4 日
コメント済み: Star Strider 2014 年 8 月 4 日
Hi,
I have an experimental dataset which I know would be fitted by erfc(x)
I tried using the custom equation option in the curve fitting toolbox, but it does not work.
The generated code looks like this
ft=fittype('A*erfc(2e5*sqrt(a*x))+c', 'independent', 'x', 'dependent', 'y' );
fitresult=fit(x,y,ft);
plot(fitresult,x,y)
and the figure after fitting
I do not know where I am going wrong.

回答 (1 件)

Star Strider
Star Strider 2014 年 8 月 4 日
編集済み: Star Strider 2014 年 8 月 4 日
You likely need to allow the function to find its own centre:
ft=fittype('A*erfc(2e5*sqrt(a*(x-b)))+c', 'independent', 'x', 'dependent', 'y' );
Your equation assumes your data are centred about x=0. Changing the expression from ‘a*x’ to ‘a*(x-b)’ allows the function to centre around b. I can’t test your code, but that should work.
  2 件のコメント
Nachiketa
Nachiketa 2014 年 8 月 4 日
Thanks for the reply!
x-b does not work (since its not real)
I tried x+b... but I still get the above figure without any fitting.
Star Strider
Star Strider 2014 年 8 月 4 日
My pleasure!
Actually this is what I intended:
ft=fittype('A*erfc(2e5*sqrt(a*x)-b)+c', 'independent', 'x', 'dependent', 'y' );
I initially put b in the wrong place in the erfc argument. My apologies. (I was up late last night fighting a spambot here on MATLAB Answers.)

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by