fitting a smooth curve
12 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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 Center および File Exchange で Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!