
How to plot non-linear least square based on a set of data without function?
2 ビュー (過去 30 日間)
古いコメントを表示
xdata= (0:10);
ydata= [0,0,0,0,0.08,0.15,0.1,0.08,0.05,0.04,0.04];
plot(xdata,ydata,'o')
I have a set of data, I was trying to plot the non-linear least square but I don't have a function that is related to this data set.
0 件のコメント
回答 (1 件)
Adam Danz
2018 年 11 月 26 日
You need a function. Non-linear least squares (or any least-squares technique) is used to fit a set of observations to a model. If you don't have a model ('function') then you have nothing to fit your data to. To demonstrate why you need a function, look at the three subplots below. These plots contain the exact same data (the data you provided) but with different scaling. The first plot looks like a flat line would fit fine; the bottom one looks like a sin wave may work; the one with the visible cusp looks like some variant of f = @(x)1-2*abs(x).^(1/2).
You could fit these data to *any* function but how would you interpret the results?
Your choice of model should be based on the questions you're asking and what process you think your data arose from. Sometimes the functions are ugly but there's usually one that works best given your data and the purpose of the fitting.

0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!