两条曲线如何让边界连接的更光滑?

13 vues (au cours des 30 derniers jours)
Yuanhang Wu
Yuanhang Wu le 14 Août 2017
x=[0.1 4.76 6.65 9.51 12.17 15.23 17.35 19.21 22.15 23.46 27.11 28.81 29.87 30.52 30.99 32.01 33.85 34.91 37.5]
y=[6.54 5.19 4.53 4.99 2.21 6.81 6.10 8.89 4.88 3.72 3.21 2.78 3.58 2.28 2.11 2.47 2.26 1.55 6]
x1=[0.1 1.7 4.80 5.98 8.83 12.18 15.21 17.92 19.50 22.23 24.56 27.31 29.11 29.87 30.87 31.51 32.89 33.78 35.71 37.5]
y1=[6.54 19.89 24.52 34.82 40.54 37.67 41.38 30.00 19.68 14.56 18.86 17.98 21.62 17.98 14.86 12.86 10.96 8.68 9.54 6]
xx=[0.1:0.0001:37.5]
xy=[0.1 :0.0001:37.5]
yi=interp1(x,y,xx,'spline');
yy=interp1(x1,y1,xy,'spline');
plot(xx,yi,'r')
hold on
plot(xy,yy)
  1 commentaire
Walter Roberson
Walter Roberson le 14 Août 2017
Approximate translation:
How does the two curves make the border more smooth?

Connectez-vous pour commenter.

Réponses (2)

Faiz Gouri
Faiz Gouri le 17 Août 2017
I understand that you would like to make curves more smooth. In order to do so, use smooth function or refer this article.
Hope this helps!

Walter Roberson
Walter Roberson le 17 Août 2017
My thought was that to get the smoothness, it would be necessary to adjust the spline end conditions to match between the two curves, something like
temp_x = [x1(3), x1(2), x1(1), x, x1(end-2), x1(end-1), x1(end)];
temp_y = [y1(3), y1(2), y1(1), y, y1(end-2), y1(end-1), y1(end)];
temp_x1 = [x(3), x(2), x(1), x1, x(end-2), x(end-1), x(end)];
temp_y1 = [y(3), y(2), y(1), y1, y(end-2), y(end-1), y(end)];
yi = interp1(temp_x, temp_y, xx, 'spline');
yy = interp1(temp_x1, temp_y1, xy, 'spline');

Community Treasure Hunt

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

Start Hunting!