Plotting Data in a 3D polar plot

I would like to plot the attached data (regarding antenna gain for different frequencies) as a 3D polar plot and I was hoping to find some function that takes theta, phi, and a radius as input (like the built in polarplot MATLAB function). I have looked Ken Garrad's and J De Freitas' 3D polar plotting functions but I don't know how to get my data formatted so that I can use their functions. I am relatively new to MATLAB so any help is much appreciated. I tried converting to Cartesian corrdinates and then plotting the data, but it does not display the data as clearly as I want.

5 commentaires

Anton Semechko
Anton Semechko le 26 Juin 2018
"3D" polar plot is used for visualizing functions defined on a disk. The data you provided appears to be sampled on a spherical grid. How were you intending to visualize your data using 3D polar plot?
The goal would be to have the data be represented as a surface so that it is easier to read. (I have been struggling trying to use the meshgrid and surf fxns) The code below yields figures like the one attached.
for frequency = 1:201 % 201 total frequencies tested
figure(frequency)
for theta = 1:19
thetaDeg = (theta - 1) * 10;
for phi = 1: 37
phiDeg = (phi - 1) * 10;
radius = dBLeft(phi, theta + (frequency-1) * 19);
thetaRad = deg2rad(thetaDeg);
phiRad = deg2rad(phiDeg);
[X, Y, Z] = sph2cart(thetaRad, phiRad, radius);
plot3(X,Y,Z, 'o', 'MarkerSize', 2);
grid on
hold on
end
end
title(['Left Circular (dBi) for ', num2str(frequency + 819), ' MHz']);
%Movie(frequency) = getframe;
hold off
end
Anton Semechko
Anton Semechko le 26 Juin 2018
I just wanted to clarify a couple of things:
1) What do the entries in column A of the 'data.xls' file (ranging from 820 to 851) represent?
2) Does each block of data, corresponding to a specific entry in column A, represent samples acquired at the same radial distance, but different spatial directions?
Ben Bladow
Ben Bladow le 26 Juin 2018
Modifié(e) : Ben Bladow le 27 Juin 2018
1) Those are the different frequencies tested for gain, i.e. 820 MHz.
2) Same radial distance and same spatial directions (I believe... if I understand your question correctly).
Anton Semechko
Anton Semechko le 27 Juin 2018
Ok. So let's take the "data block" in 'data.xls' for 820 Hz, what are the Cartesian coordinates of the samples in cells C3 to C39? Please post the code used to obtain the answer on here.

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 26 Juin 2018

0 votes

[num,txt,raw] = xlsread('data.xls') ;
th = num(1,3:end) ;
phi = num(3:39,3:end) ;
th = repmat(th,size(phi,1),1) ;
u = sin(th).*cos(phi) ;
v = sin(th).*sin(phi) ;
quiver(u,v)

1 commentaire

Ben Bladow
Ben Bladow le 26 Juin 2018
Hey, thanks for the response. I tried out your code and I don't think a quiver graph helps make the data more visually readable. Of course it might just be because I don't know how to read one...

Connectez-vous pour commenter.

Catégories

En savoir plus sur Polar Plots dans Centre d'aide et File Exchange

Question posée :

le 26 Juin 2018

Commenté :

le 27 Juin 2018

Community Treasure Hunt

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

Start Hunting!

Translated by