Interpolate value between arc

조회 수: 4 (최근 30일)
TS Low
TS Low 2017년 11월 19일
댓글: TS Low 2017년 11월 26일
Note that now I have this function to create my arc
a=[1 1]; %P1
b=[9 9]; %P2
r=10; %radius
syms x y
[x,y]=solve((x-a(1))^2+(y-a(2))^2==r^2,(x-b(1))^2+(y-b(2))^2==r^2,x,y);
syms X Y
ezplot((X-x(1))^2+(Y-y(1))^2==r^2,[min(a(1),b(1)),max(a(1),b(1)), ...
min(a(2),b(2)),max(a(2),b(2))])
axis equal
ezplot((X-x(2))^2+(Y-y(2))^2==r^2,[min(a(1),b(1)),max(a(1),b(1)), ...
min(a(2),b(2)),max(a(2),b(2))])
axis equal
After plotting the arc, I need to know the points lie between the arc with random interpolate points n
How to do this?
  댓글 수: 3
TS Low
TS Low 2017년 11월 19일
편집: TS Low 2017년 11월 19일
ok, i think u comment on my previous post too
the points lie between point A and B
In this case, which is (1,1) and (9,9)
Now i am going to give matlab interpolate number of 7 (example)
Then, the result i want should be
(1.788,2.566)
(2.566,2.888)
(...)
(...)
(...)
(...)
(8.777,8.888)
*[Just example, not true value]
Walter Roberson
Walter Roberson 2017년 11월 19일
Those ezplot need to be changed to fimplicit

댓글을 달려면 로그인하십시오.

답변 (3개)

Walter Roberson
Walter Roberson 2017년 11월 19일
The equation you are using is a circle centered at x(1), y(1) with radius r. You know the endpoints; you can convert them into polar coordinates relative to the center. Now use linspace(first_theta, second_theta, 10) as the angle and r as the radius and put that through pol2cart, add x(1), y(1) to get the cartesian coordinates of the points of interest.
  댓글 수: 9
Walter Roberson
Walter Roberson 2017년 11월 22일
Ah... I just tried again and this time ezplot worked, at least in R2017b. You could try changing to ezplot()
TS Low
TS Low 2017년 11월 26일

댓글을 달려면 로그인하십시오.


Roger Stafford
Roger Stafford 2017년 11월 19일
편집: Walter Roberson 2017년 11월 19일
I contend the right way to do that task is to calculate the center of the circular arc you have defined, and then generate the plotted arc using a varying angle that swings from the first point to the second point. You can carry out the desired interpolations in terms of values of this arc angle using 'interp1'.
You might be interested in the following "Answers" contribution:
(which I think was asked by you, TS Low.)
  댓글 수: 1
Roger Stafford
Roger Stafford 2017년 11월 19일
You should not expect the contributors who answer questions to do all your work for you. It should be sufficient to indicate the solution to difficulties you are facing. You should fill in the rest of the details yourself. Otherwise, how are you going to learn Matlab programming?

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2017년 11월 19일
Try spline(). See my attached demo.
  댓글 수: 3
Image Analyst
Image Analyst 2017년 11월 19일
Of course you could use spline, but actually I think Walter's linspace idea is much simpler.
TS Low
TS Low 2017년 11월 20일
thx bro

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by