Curve fitting (Noise)

2 ビュー (過去 30 日間)
Abraham
Abraham 2018 年 11 月 15 日
コメント済み: madhan ravi 2018 年 11 月 15 日
So I have this table of data, x and f(x). I am trying use an appropriate technique to fit a curve to the data
But when I try to plot the data, I get this error message " Array indices must be positive integers or logical values". I guess because of the negative values
But excel actually did it with no problem.
Please, what do i do?
x = [0 0.1579 0.3158 0.4737 0.6316 0.7895 0.9474];
f(x) = [-0.3637 0.3164 -1.1263 -1.0672 0.1076 1.8249 -0.1899];
plot( x,f(x),'o');

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 15 日
編集済み: madhan ravi 2018 年 11 月 15 日
Use interp1() with suitable method:
x = [0 0.1579 0.3158 0.4737 0.6316 0.7895 0.9474];
f = [-0.3637 0.3164 -1.1263 -1.0672 0.1076 1.8249 -0.1899];
xx = linspace(x(1),x(end),1000);
yy=interp1(x,f,xx,'spline');
plot( x,f,'o',xx,yy,'r');
  2 件のコメント
Abraham
Abraham 2018 年 11 月 15 日
Thanks a lot. That solves the problem
madhan ravi
madhan ravi 2018 年 11 月 15 日
Anytime :) , make sure to accept the answer

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by