MATLAB Answers

how to resample points with preset angle

조회 수: 7(최근 30일)
BeeTiaw
BeeTiaw 2018년 6월 27일
답변: Ameer Hamza 2018년 6월 27일
Hi expert,
I am not sure if the title of this post represents the question I am going to ask very well.
I have the coordinate of a rounded triangle as shown in the plot
The coordinate of the plot is listed below. My question is how to resample this curve suppose I want to have them every theta = 2*pi/37 or every 10 degree spacing.
the x and y coordinate of the triangle is:
0.7900 0
0.7898 0.0816
0.7893 0.1627
0.7883 0.2426
0.7868 0.3211
0.7847 0.3974
0.7819 0.4712
0.7781 0.5420
0.7733 0.6094
0.7672 0.6730
0.7596 0.7325
0.7503 0.7875
0.7391 0.8379
0.7257 0.8834
0.7100 0.9238
0.6917 0.9591
0.6707 0.9892
0.6467 1.0141
0.6197 1.0338
0.5895 1.0484
0.5560 1.0580
0.5191 1.0627
0.4789 1.0627
0.4353 1.0583
0.3885 1.0497
0.3384 1.0371
0.2852 1.0208
0.2291 1.0010
0.1703 0.9782
0.1090 0.9526
0.0454 0.9244
-0.0200 0.8940
-0.0870 0.8616
-0.1553 0.8276
-0.2244 0.7922
-0.2940 0.7557
-0.3637 0.7182
-0.4330 0.6800
-0.5016 0.6414
-0.5690 0.6024
-0.6348 0.5632
-0.6986 0.5240
-0.7600 0.4848
-0.8185 0.4458
-0.8739 0.4071
-0.9258 0.3686
-0.9737 0.3305
-1.0175 0.2926
-1.0569 0.2552
-1.0915 0.2180
-1.1212 0.1812
-1.1458 0.1446
-1.1650 0.1082
-1.1789 0.0721
-1.1872 0.0360
-1.1900 0
-1.1872 -0.0360
-1.1789 -0.0721
-1.1650 -0.1082
-1.1458 -0.1446
-1.1212 -0.1812
-1.0915 -0.2180
-1.0569 -0.2552
-1.0175 -0.2926
-0.9737 -0.3305
-0.9258 -0.3686
-0.8739 -0.4071
-0.8185 -0.4458
-0.7600 -0.4848
-0.6986 -0.5240
-0.6348 -0.5632
-0.5690 -0.6024
-0.5016 -0.6414
-0.4330 -0.6800
-0.3637 -0.7182
-0.2940 -0.7557
-0.2244 -0.7922
-0.1553 -0.8276
-0.0870 -0.8616
-0.0200 -0.8940
0.0454 -0.9244
0.1090 -0.9526
0.1703 -0.9782
0.2291 -1.0010
0.2852 -1.0208
0.3384 -1.0371
0.3885 -1.0497
0.4353 -1.0583
0.4789 -1.0627
0.5191 -1.0627
0.5560 -1.0580
0.5895 -1.0484
0.6197 -1.0338
0.6467 -1.0141
0.6707 -0.9892
0.6917 -0.9591
0.7100 -0.9238
0.7257 -0.8834
0.7391 -0.8379
0.7503 -0.7875
0.7596 -0.7325
0.7672 -0.6730
0.7733 -0.6094
0.7781 -0.5420
0.7819 -0.4712
0.7847 -0.3974
0.7868 -0.3211
0.7883 -0.2426
0.7893 -0.1627
0.7898 -0.0816
0.7900 0

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 6월 27일
Try this
x = points(:,1); % first column of points you shared
y = points(:,2); % second column of points
x_new = interp1(linspace(0, 2*pi, numel(x)), x, 0:2*pi/37:2*pi);
y_new = interp1(linspace(0, 2*pi, numel(y)), y, 0:2*pi/37:2*pi);
x_new and y_new contains the required points.

추가 답변(0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by