関数fitでデータの​近似曲線を求め方を教​えてください

19 views (last 30 days)
Nakasima
Nakasima on 7 Aug 2020
Commented: michio on 7 Aug 2020
データの近似曲線を求めたくて関数fitを使用しました。データはx1とy1の2次元グラフです。fitを使用した時、x1,y1をdouble型にしてから近似曲線の種類fitTypeを指定しました。実行すると、次のようなエラーがでました。
関数 'fit' の呼び出し内に、不足している引数または正しくない引数データ型がないかを確認してください。
どうすれば正しく実行できるか教えてください。
コード
p=fit(x1,y1,'exp1');

Answers (1)

michio
michio on 7 Aug 2020
x = rand(10,1);
y = rand(10,1);
p = fit(x,y,'exp1')
p =
一般モデル Exp1:
p(x) = a*exp(b*x)
係数 (95% の信頼限界):
a = 0.3623 (0.05425, 0.6704)
b = 0.9283 (-0.5022, 2.359)
ということで、使い方自体に問題はなさそうです。
入力されている変数 x1, y1 のデータ型など今一度ご確認頂けますか?
  2 Comments
michio
michio on 7 Aug 2020
おっしゃる通り、fit での関数近似は Curve Fitting Toolbox が必要です。

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!