fitting a smooth curve

25 Ansichten (letzte 30 Tage)
Busy Bee
Busy Bee am 31 Jan. 2018
Kommentiert: Busy Bee am 31 Jan. 2018
I have the data as given. I need to fit a smooth curve through the data. The one I am getting right now for the second, third degree is relatively same(attached below). But I need one with a smooth curve. not the sharp turns. It doesn't matter if it passes through all the points or not. Any suggestions?
203.0173 -195.6477
275.3912 -244.2275
331.9024 -222.4161
387.4221 -173.8364

Akzeptierte Antwort

Birdman
Birdman am 31 Jan. 2018
Bearbeitet: Birdman am 31 Jan. 2018
Curve Fitting Tool should do it for you:
x=[203.0173 275.3912 331.9024 387.4221];
y=[-195.6477 -244.2275 -222.4161 -173.8364];
%%below from here requires and comes from Curve Fitting Toolbox
[xData, yData] = prepareCurveData( x, y );
ft = fittype( 'poly3' );
[fitresult, gof] = fit( xData, yData, ft );
figure( 'Name', 'Fitted Model' );
h = plot( fitresult, xData, yData );
legend( h, 'y vs. x', 'Fitted Model', 'Location', 'NorthEast' );
xlabel x
ylabel y
grid on
You can reach the fitted model(3rd in this case) by typing
fitresult

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by