Continue to Site

# Balanis Graphs in Matlab

Status
Not open for further replies.

#### ahsaan

##### Member level 5
graphs in mat lab

Hi/AA

does any one know or has the implementation of balanis
book equation no 14.92 in matlab? It should plot the graph
given in the book. Or any idea about the codes of all the graphs in balanis book
specially CHP 14 eq14.92? I have done myself but getting some error.
Thank you

book matlab graph

Hi, i gave a quick look to Balanis and in your matlab files there are few errors.
First of all I woul suggest you to avoid to use i as counter for the for cycle coz i is also sqrt(-1). I usually use ii instead of just i. Also sum is a matlab function so u'd better use another name for that variable.

Anyway, going back to ur code the mistakes I spotted are:

eps = 2.2; i think u need to multiply this for eps_0 (8.85e-12 or something similar)

z = (0:0.2:1)'; %Bessel Function (first kind order zero is reqd)
J = besselj(1,z);
This doesn't make sense coz u have to use as argument for the Bessell function what u multiply for it in the next lines of code:
c = 2.*J.*(Y.*2*pi.*sin(i)./lam); - wrong
c = 2.*J(1,(Y.*2*pi.*sin(i)./lam); - probably correct
u dont need z at all.

for i=0i would evaluate i=0,1,2 and 3 but 4 points might be not enough for a numerical integration. use something like for ii=0:dθi with dθ=pi/50.

dont forget to multiply the integral argument for dθ, in your case this would mean:
f = (a.*b.*(c+d+e))*dθ;
or u can actually do this in the end after the for cycle: sum=sum*dθ;

cheers

Points: 2