Simple Integration equation HELP
Show older comments
Dear friends, i am really in trable, i am trying to find the specific attenuation due to rain but i have problem in my code and i am asking you your help. My problem is in the last command which is an integration operation, and i am sure you will do your best for helping me. The link below is for the equations and it's followed by the code.
radius = 1;
nMax = 40; % maximum mode number
No=8*10^3; %m^ -4
R1=140; %rainfall rate=1mm/hr
AS1=8.2*R1^-0.21;
N1D=No*exp(-AS1*radius*1e-3);
% mode numbers
mode = 1:nMax;
frequency = 6e9;
% speed of light
c = 299792458.0;
lambda = c / ( frequency ) ;
for n=1:10;
n2 = (2*n+1);
% radian frequency
w = 2.0*pi*frequency;
% wavenumber
k = w/c;
% conversion factor between cartesian and spherical Bessel/Hankel function
s = sqrt(0.5*pi/(k*radius));
% compute spherical bessel, hankel functions
[J(mode)] = besselj(mode + 1/2, k*radius); J = J*s;
[H(mode)] = besselh(mode + 1/2, 2, k*radius); H = H*s;
[J2(mode)] = besselj(mode + 1/2 - 1, k*radius); J2 = J2*s;
[H2(mode)] = besselh(mode + 1/2 - 1, 2, k*radius); H2 = H2*s;
% derivatives of spherical bessel and hankel functions
% Recurrence relationship, Abramowitz and Stegun Page 361
kaJ1P(mode) = (k*radius*J2 - mode .* J );
kaH1P(mode) = (k*radius*H2 - mode .* H );
% Ruck, et. al. (3.2-1)
An = -((1i).^mode) .* ( J ./ H ) .* (2*mode + 1) ./ (mode.*(mode + 1));
% Ruck, et. al. (3.2-2), using derivatives of bessel functions
Bn = ((1i).^(mode+1)) .* (kaJ1P ./ kaH1P) .* (2*mode + 1) ./ (mode.*(mode + 1));
Qt = (lambda^2/2*pi)*sum(n2).*sum(real(An + Bn));
end
Co1=4.343*No;
==============================================================
NOW HOW TO FIND THE INTEGRATION OF "k", where k=integration of (Qt*N1D)
7 Comments
Jan
on 4 Aug 2013
What exactly is your question?
sese
on 5 Aug 2013
Jan
on 5 Aug 2013
I see a grey page with some blue and white icons. Perhaps the service wants me to enable JavaScript, but I'm not willing to reduce the security level of my browser. It would be kind, if you post your question completely here instead of storing a file on a foreign hoster.
sese
on 5 Aug 2013
Please do not send me questions by email, but insert all important information into the question, where readers expect them. Hiding them in comments or trying to push the contributors is a bad idea.
Did you read my profile while you've sent your question through the profiles interface?
Mike Hosea
on 6 Aug 2013
This question is a repeat of
Jan
on 6 Aug 2013
I got 5 emails today with questions which belongs to the forum. Two of them were double posts also. It seems to be the day of the nervous askers.
Answers (1)
Walter Roberson
on 5 Aug 2013
Change
n2 = (2*n+1);
to
n2(n) = (2*n+1);
Change
An = -((1i).^mode) .* ( J ./ H ) .* (2*mode + 1) ./ (mode.*(mode + 1));
% Ruck, et. al. (3.2-2), using derivatives of bessel functions
Bn = ((1i).^(mode+1)) .* (kaJ1P ./ kaH1P) .* (2*mode + 1) ./ (mode.*(mode + 1));
Qt = (lambda^2/2*pi)*sum(n2).*sum(real(An + Bn));
end
to
An(n) = -((1i).^mode) .* ( J ./ H ) .* (2*mode + 1) ./ (mode.*(mode + 1));
% Ruck, et. al. (3.2-2), using derivatives of bessel functions
Bn(n) = ((1i).^(mode+1)) .* (kaJ1P ./ kaH1P) .* (2*mode + 1) ./ (mode.*(mode + 1));
end
Qt = (lambda^2/2*pi)*sum(n2 .* real(An + Bn));
end
Also, in theory you should change
for n=1:10;
to
for n=1:inf
but you are unlikely to have an infinite amount of memory or an infinite amount of time to wait.
Now in addition to all of this, you should not be setting "radius" to 1.0, or frequency to 6e9 or running mode over 1:40 : you should be bundling everything into a function that takes radius and lambda and the mode number as parameters. You would then be invoking that function from within integrate() or quadgk(), using parameterization to pass in one specific lambda and mode number, such as
this_frequency = 6e9;
this_lambda = c ./ this_frequency;
this_mode_number = 5;
low_r = 0;
high_r = 173;
k = integrate(@(r) compute_Qt(r, this_lambda, this_mode_number), [low_r, high_r]);
Please review the equations and notice that only one mode number (m) is used, not a range of mode numbers. If for some reason you want to compute for different mode numbers, that should be done by a series of integrals.
1 Comment
Categories
Find more on Special Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!