[英]Something strange using polar plot function in MATLAB
I have a simple function of theta and I want to plot this function in dB using the polarplot
function in MATLAB. 我有一个简单的theta函数,我想使用MATLAB中的
polarplot
函数以dB为单位绘制此函数。 But when I make the graph from -40 to 0, the graph seems to have a strange part around horizontal axis. 但是,当我将图形从-40变为0时,该图形似乎在横轴上有一个奇怪的部分。 My MATLAB code (R2016a) is:
我的MATLAB代码(R2016a)是:
%% Define range of plotting angle.
ceta= [10^-9:0.0001:2*pi];
% ceta starts not from pure zero to avoid 0/0 in some cases.
E = abs( ( cos((cos(ceta))*pi/2) ) ./ ( sin(ceta) ) );
power_dB = 10.*log10(E.^2);
power_dB = power_dB - max(power_dB);
max(power_dB)
polarplot(ceta,power_dB);
rlim([-40 0]);
The obtained figure is this: 获得的数字是这样的:
Your values for E are very near to 0 when ceta = 0, pi, or 2pi. 当ceta = 0,pi或2pi时,您的E值非常接近0。 This is resulting in very large values when you take the log of E.
当您取E的对数时,这将导致非常大的值。
You can just remove the points from ceta and E when E is very low. 当E非常低时,您可以从ceta和E中删除点。 See the code block below.
请参见下面的代码块。
E = abs( ( cos((cos(ceta))*pi/2) ) ./ ( sin(ceta) ) );
ceta(E<1e-2) = [];
E(E<1e-2) = [];
power_dB = 10.*log10(E.^2);
power_dB = power_dB - max(power_dB);
max(power_dB)
polarplot(ceta,power_dB);
rlim([-40 0]);
Gives: 给出:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.