Plotting Radiation Pattern in 3D (in dB)
显示 更早的评论
I am trying to plot the radiation pattern of cos^9(theta) in matlab where theta is the elevation. The code I have so far is the following:
theta = linspace(-pi/2, pi/2);
phi = linspace(0, pi);
[phi, theta] = meshgrid(phi, theta);
rho = 10.*log10((cos(phi)).^9) + 30;
[x,y,z] = sph2cart(phi, theta, rho);
mesh(x,y,z);
The issue is that the log of the cosine creates complex values that cannot be plotted (I do not wish to plot these values either). How should I fix the above code?
I also have access to patternCustom in the antenna toolbox but I am unsure how to use it.
Thank you for your time, help, and advice.
3 个评论
Jon Ho
2022-2-3
Prahlad Gowtham Katte
2022-2-14
编辑:Prahlad Gowtham Katte
2022-2-14
Hello @Jon Ho
I tried the following piece of code in MATLAB R2021b
theta = linspace(-pi/2+0.1,pi/2-0.1);
phi = linspace(0,2*pi);
rho = 10.*log10((cos(theta)).^9) + 30;
patternCustom(rho,theta,phi);
I got the above figure as output.If the problem is not yet solved , please tell the version of MATLAB which you are using currently.
.
Mathieu NOE
2022-2-14
helo
I simply added an abs to your code to avoid taking the log of negative data but I'm unsure this is making sense...

theta = linspace(-pi/2, pi/2,100);
phi = linspace(0, pi,100);
[phi, theta] = meshgrid(phi, theta);
rho = 10.*log10(abs((cos(phi)).^9)) + 30; % <= here
[x,y,z] = sph2cart(phi, theta, rho);
mesh(x,y,z);
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
