passing variable value into fittype function

1 回表示 (過去 30 日間)
David
David 2012 年 2 月 22 日
Hello,
I am having some trouble passing variables into the fittype function.
I would like to pass the coefficient value from a Hermite Polynomial (Hp(n)) into a fit:
Hp=HermitePoly(1);
fit11=fittype(@(a,b,c,x) a*b^2/c^2*(Hp(1)*sqrt(2)*x/c)*exp(-x^2/c^2));
This doesn't work, neither, for some reason, does the example given on the website:
c = 1;
g = fittype( @(a, b, x) a*x.^2+b*x+c )
I tried to run those two lines of code and I am told "First input argument must be a string or cell array"
Am I missing something really obvious here?
Any help would be greatly appreciated.
Thanks, David
  1 件のコメント
Andrew Newell
Andrew Newell 2012 年 2 月 22 日
Which version of MATLAB are you using?

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

回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by