Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

how to find the best curve fit for a set of data?

2 Ansichten (letzte 30 Tage)
Deva Narayanan
Deva Narayanan am 28 Dez. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
i have set of data points and want to know the best curve fit equation for this data . can any one explain me
  2 Kommentare
Image Analyst
Image Analyst am 28 Dez. 2018
Do you want to include the flat parts in the fit?
Do you want a piecewise fit, like one for the flat parts and one for the curved parts?
Is there any particular model you'd like (exponential, polynomial, etc.)?
[data, strings, raw] = xlsread('matlab_data.xls')
x1 = data(:, 1);
y1 = data(:, 2);
x2 = data(:, 4);
y2 = data(:, 5);
subplot(2, 1, 1);
plot(x1, y1, 'b-', 'LineWidth', 2);
grid on;
subplot(2, 1, 2);
plot(x2, y2, 'b-', 'LineWidth', 2);
grid on;
0001 Screenshot.png
Deva Narayanan
Deva Narayanan am 29 Dez. 2018
yes i need piecewise polynomials for both curved and flat model

Antworten (1)

KSSV
KSSV am 28 Dez. 2018
[num,txt,raw] = xlsread('Matlab_data.xls') ;
x1 = num(:,1) ; y1 = num(:,2) ;
p = polyfit(x1,y1,3) ;
x1i = x1 ;
yi = polyval(p,x1i);
y1i = polyval(p,x1);
plot(x1,y1,'r')
hold on
plot(x1i,y1i,'b')

Diese Frage ist geschlossen.

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by