3 views (last 30 days)

Hi, I would like to draw the same figure below from the two reference equations. However, the figure I obtained was not quite similar to what I wanted.

Here is my code for the simulation.

Plot a Figure of Spetrum power

theta = -100/180*pi:5*pi/180:100/180*pi;

%plot(theta*180/pi,sin(theta))

cell radius

Gain=[]

cell_radius = [10 5 2] %km

for i=1:length(cell_radius)

HAP_altitude = 20 %km

phi_3db = 2*atan(cell_radius(i)/HAP_altitude*pi/180)

Gain(i,:) = 0.7*(2*besselj(1,70*pi/phi_3db.*sin(theta))./sin(theta)).^2

plot(theta*180/pi,10*log(mapminmax(Gain(i,:), 0, 1)))

hold on

end

legend('10km','5km','2km')

My result is below.

Thank you so much in advance.

David Goodmanson
on 30 Aug 2019

Edited: David Goodmanson
on 30 Aug 2019

Hello MT,

The basic issue is setting phi_3db to degrees, but there may also be a problem with the basic definition of phi_3db (more on that shortly). The conversion is not

phi_3db = 2*atan(cell_radius(i)/HAP_altitude*pi/180)

with the conversion factor in the argument of atan, but rather

phi_3db = (180/pi)*2*atan(cell_radius(i)/HAP_altitude)

with the conversion factor outside. (Also, conversion to dB requires log10, not log).

Rather than having a bunch of factors of 180/pi floating around, the code below uses the sind and atand functions.

I don't have the mapminmax function (Deep Learning Toolbox) so I just normalized G in the usual way and didn't worry about mapping the minimum to zero.

Major functionality in toolboxes is is one thing, that's what toolboxes are for. But Mathworks has gotten good at creating simple, short 'convenience' toolbox functions that actually make things a lot less less convenient for people who want to run some vanilla piece of code and don't have all the toolboxes. Is it a ploy to force people to buy more toolboxes? Probably not. The effect is the same, though.

The plot looks a lot better after converting to degrees in eqn (2)

phi_3db = 2*atand(cell_radius(i)/HAP_altitude) (2) original

But eqn (2) does not quite reproduce the figure. Interestingly, the equation

phi_3db = atand(2*cell_radius(i)/HAP_altitude) (3) modified

does reproduce the figure. So now we have the choice, is eqn (2) correct and the figure incorrect? Or are both eqn (3) and the figure correct, and eqn (2) incorrect?

%Plot a Figure of Spectrum power

theta = (-100:.01:100);

%cell radius

Gain=[]

cell_radius = [10 5 2] %km

for i=1:length(cell_radius)

HAP_altitude = 20; %km

% phi_3db = 2*atand(cell_radius(i)/HAP_altitude) % (2) original

phi_3db = atand(2*cell_radius(i)/HAP_altitude) % (3) modified

Gain(i,:) = 0.7*(2*besselj(1,(70*pi/phi_3db)*sind(theta))./sind(theta)).^2;

figure(1)

plot(theta,10*log10((Gain(i,:)/max(Gain(i,:)))))

hold on

end

legend('10km','5km','2km')

hold off

David Goodmanson
on 31 Aug 2019

Hello MT

The paper appears to be in error, because eqn (2) and the figure do not agree. I don't know which is correct, because I don't know this subject. At this point I think you had better look at other papers on the topic and/or at textbooks to find out whether eqn (2) is correct and the figure is wrong, or eqn (3) is correct and the figure is right. You can't afford to propagate an error due to lack of knowledge.

David Goodmanson
on 2 Sep 2019

Hello MT,

I appreciate your comment. Once you determine the correct expression and plot, I would be interested to hear what they are.

Opportunities for recent engineering grads.

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

Start Hunting!
## 0 Comments

Sign in to comment.