![181126 173302-Figure 2.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196974/181126%20173302-Figure%202.jpeg)
How to plot non-linear least square based on a set of data without function?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Adam Danz
il 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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196974/181126%20173302-Figure%202.jpeg)
0 Commenti
Vedere anche
Categorie
Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!