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

1 Ansicht (letzte 30 Tage)
Yeahh
Yeahh am 26 Nov. 2018
Beantwortet: Adam Danz am 26 Nov. 2018
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.

Antworten (1)

Adam Danz
Adam Danz am 26 Nov. 2018
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

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by