How to plot non-linear least square based on a set of data without function?

1 次查看(过去 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.

回答(1 个)

Adam Danz
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.
181126 173302-Figure 2.jpg

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by