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
Jon Ho 2022 年 2 月 3 日
> 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);
This code also fails to generate any pattern.
Prahlad Gowtham Katte
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
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 ExchangePolar Plots についてさらに検索

質問済み:

2022 年 2 月 3 日

コメント済み:

2022 年 2 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by