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=0
i 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