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

2 vues (au cours des 30 derniers jours)
Yeahh
Yeahh le 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.

Réponses (1)

Adam Danz
Adam Danz le 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

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by