Spline to optimize the curve

2 ビュー (過去 30 日間)
mohammed alany
mohammed alany 2019 年 3 月 25 日
コメント済み: mohammed alany 2019 年 3 月 31 日
if i have the points bellow, and i would like to optimize the line connected each two points? i.e. to make it smothely.
who i can do it using "Spline" or any other code??the important thing is at the end the line must optomize and Passing all these point
6x2 double
[ 2.0000 2.0000
2.2703 1.6902
4.7244 7.6318
12.0984 9.1030
12.0000 10.0000 ]
  1 件のコメント
John D'Errico
John D'Errico 2019 年 3 月 31 日
Don't answer your question with a response to another answer, and then accept your own non-answer.

サインインしてコメントする。

採用された回答

KSSV
KSSV 2019 年 3 月 25 日
c = [ 2.0000 2.0000
2.2703 1.6902
4.7244 7.6318
12.0984 9.1030
12.0000 10.0000 ] ;
x = c(:,1) ;
y = c(:,2) ;
xi = min(x):0.1:max(x) ;
yi = spline(x,y,xi) ;
plot(x,y,'*r')
hold on
plot(xi,yi)

その他の回答 (1 件)

John D'Errico
John D'Errico 2019 年 3 月 31 日
編集済み: John D'Errico 2019 年 3 月 31 日
It seems you want to interpolate these points, doing so smoothly, yet not going outside the data.
xy = [ 2.0000 2.0000
2.2703 1.6902
4.7244 7.6318
12.0984 9.1030
12.0000 10.0000 ] ;
x = xy(:,1) ;
y = xy(:,2) ;
You can download my interparc from the file exchange.
xyi = interparc(100,x,y,'pchip');
plot(x,y,'bo',xyi(:,1),xyi(:,2),'r-')
Find interparc on the file exchange:
Or, possibly, your goal is a smoothed approximation.
slm = slmengine(x,y,'plot','on','knots',3,'increasing','on');
Find slmengine in my SLM toolbox. Also on the FEX.
  1 件のコメント
mohammed alany
mohammed alany 2019 年 3 月 31 日
thanks dear

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by