필터 지우기
필터 지우기

Obtaining vertical and horizontal values from polarplot

조회 수: 1 (최근 30일)
matlabkid602
matlabkid602 2021년 11월 26일
편집: Les Beckham 2022년 1월 4일
I have data theta and rho data which produces a polar plot via the polarplot function.
I want to obtain the values for every angle of the y value divided by the x value, I am struggling on how to obtain this from the polarplot. Any help much appreciated.

답변 (1개)

Les Beckham
Les Beckham 2021년 11월 26일
편집: Les Beckham 2022년 1월 4일
The polarplot function won't give you the x and y data. So, you need to calculate it yourself.
I've made up r and theta values since you didn't provide yours.
theta = linspace(0, 2*pi, 100);
r = 1 + (1 + cos(theta))/2;
polarplot(theta, r)
% calculate x and y from r and theta
x = r.*sin(theta);
y = r.*cos(theta);
% plot x divided by y against theta
plot(theta, x./y) % note the ./ to get element-by-element divide
grid on
xlabel 'theta'
ylabel 'x/y'
Note that x divided by y actually goes to infinity when y = 0. Fortunately, the linearly spaced theta vector that I used didn't result in any y values that were exactly zero or we would have gotten an error. due to dividing by zero.

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by