triple infinte summation loop
Afficher commentaires plus anciens
Hello ,
I am trying to write a code requiring a multi summation calculation from and to infinity (the equations is attached) . I have problem in coding this and not sure the way I have written that is correct and efficient.I simple substitute infinity to a number (e.g. 100 and 250) but not sure this is correct or not can please advise and check the code as well?
%%Calculating Z(k,n) to be used in the multi summation loop
z=zeros(100,4);
k=[1:100];
z1=2*hd*k+rwed;
z2=2*hd*(k+1)-rwed;
z3=2*hd*(k)+(2*zwd+rwed);
z4=2*hd*(k+1)-(2*zwd+rwed);
z=[z1;z2;z3;z4];
z=z';
%%Multi summation loop
P1=0;
for n=1:4
for k=1:100
for l=1:250
b1(n,k,l)=sqrt((2*l*yed)^2+z(k,n)^2);
b2(n,k,l)=sqrt((2*ywd-2*l*yed)^2+z(k,n)^2);
Arg_1=b1(n,k,l)*sqrt(s);
Arg_2=b2(n,k,l)*sqrt(s);
D=besselk(0,Arg_1)+besselk(0,Arg_2);
P1=P1+D;
end
end
end
F1=P1*(kd*hd)/xed;
I would really appreciate your help in solving my problem.
Regards, Ehsan
Réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!