MATLAB: Plotting antenna field patterns in spherical coordinates

3d plotantennaspherical coordinates

Hi, I have a 2D array which of the form A(theta, phi) and I want to plot A as a 3D surface. I have read advice which suggests to use the sph2cart function to convert to Cartesian coordinates, then use surf or mesh, but as size(A) = 46 90, i.e. it is not a square 2D array, it will not work. Any suggestions? Thanks

Best Answer

Why do you think your array needs to be square? Mesh, surf, etc. will accept any gridded data. Assuming your A values represent the radius at any given theta and phi:
theta = linspace(0, pi, 90);
phi = linspace(0, 2*pi, 46);
[theta, phi] = meshgrid(theta, phi);
A = ones(size(theta));
[x,y,z] = sph2cart(theta, phi, A);
mesh(x,y,z)
Is this what you're after?
Related Question