How can I calculate the modulus and argument for every point in a plot?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all,
Suppose, I have a scattered plot like this -
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1347949/image.png)
I want find out the θ, and r for every corresponding point. Can anyone please give me an idea on how to do that?
The X, Y values are in XY.mat file I added. Where,
X = xy(:,1);
Y = xy(:,2);
Any feedback will be highly appreciated!
댓글 수: 0
채택된 답변
Walter Roberson
2023년 4월 6일
[theta, r] = cart2pol(X, Y);
댓글 수: 2
Walter Roberson
2023년 4월 6일
The values are calculated relative to (0,0) . If you want to calculate relative to some other point, subtract that other point from X and Y .
theta = atan2(Y, X) and so is radians.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!