Good non linear Regression

4 Ansichten (letzte 30 Tage)
Jessica Larry
Jessica Larry am 30 Apr. 2020
Kommentiert: Alex Sha am 1 Mai 2020
I have the following data:
x = [15, 25, 35, 45, 55, 65, 75]
y = [22.3, 27.5, 28.8, 29.9, 29.6, 27.4, 23.3]
How could I create a good regression that would fit the data above best. I'm trying to plot them both on the same graph so you can see the different between both lines.
  4 Kommentare
Ameer Hamza
Ameer Hamza am 1 Mai 2020
Is this result also from 1stOpt? Did you specify the equation or the toolbox is also able to find a suitable equation to fit the data points automatically? I have never tried it, so I am not aware of all the features.
Alex Sha
Alex Sha am 1 Mai 2020
There is also a function in 1stOpt in which the best fit model function could be serached automatically according to the data user provided.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 30 Apr. 2020
Bearbeitet: Ameer Hamza am 30 Apr. 2020
One option is to use smoothingspline option from the curve fitting toolbox
x = [15, 25, 35, 45, 55, 65, 75];
y = [22.3, 27.5, 28.8, 29.9, 29.6, 27.4, 23.3];
model = fit(x(:), y(:), 'smoothingspline');
plot(x, y, 'r+');
hold on
xv = linspace(min(x), max(x));
plot(xv, model(xv), 'b-');
  2 Kommentare
Jessica Larry
Jessica Larry am 30 Apr. 2020
Bearbeitet: Jessica Larry am 30 Apr. 2020
I was able to resolve it, thank you so much for the help!!
Ameer Hamza
Ameer Hamza am 30 Apr. 2020
Glad to be of help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

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

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by