Set new origin in polar coordinates

조회 수: 26 (최근 30일)
Jiong Yang
Jiong Yang 2020년 5월 18일
댓글: Jiong Yang 2020년 5월 19일
Hi, I have a set of data in polar coordinates (r, theta). The default origin for matlab is (0,0). How I can change the origin to other points, such as (0,3)?
Thanks a lot.
  댓글 수: 1
darova
darova 2020년 5월 18일
Can you plot data in cartesian system?

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 18일
편집: Ameer Hamza 2020년 5월 18일
One of the easiest ways I can think of is to convert the points from polar to cartesian, do the translation, and then convert back to polar. For example
r = 1;
theta = linspace(0, 2*pi, 100);
translate = [0 3];
x = r*cos(theta) + translate(1);
y = r*sin(theta) + translate(2);
r_trans = hypot(y, x);
theta_trans = atan2(y, x);
polarplot(theta_trans, r_trans)
Original:
Translated:
  댓글 수: 1
Jiong Yang
Jiong Yang 2020년 5월 19일
Thank you very much, Ameer. Your anwser solves my problem!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by