fitting a smooth curve

12 次查看(过去 30 天)
Busy Bee
Busy Bee 2018-1-31
评论: Busy Bee 2018-1-31
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

采纳的回答

Birdman
Birdman 2018-1-31
编辑:Birdman 2018-1-31
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by