Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to calculate double infinite sum defined by this I want to have 100 values of summ i.e One for every different value of 'p', every time using one specific value of 'deltaHvec'. I mean for first first value of 'summ', p=1 and deltaH=deltaHvec(1). For second value of 'summ' 'p=2' and deltaH=deltaHvec(2). The problem is final graph of 'summ' should be equal or less than magnitude of 'deltaHvec'. But I am getting quite higher values of 'summ' which represents that I am adding extra values in 'summ' with every successive step
.

What I have tried:

x = 45; % to calculate omega and u
l = 300; % to calculate omega
p = 100;
omega= x/l; deltaHvec = sin(linspace(0.3,2.6,100));
deltat = 5; % to calculate u
v = 40; % to calculate u
u = x/sqrt(v*deltat); suma = 0;
for i = 1:p
deltaH=deltaHvec(i);
for m = 1:i
for n = 1:1000
e1Arg=(2*(n-1)*u + u*omega) / (2*omega*sqrt(p-m));
e1=erfc(e1Arg);
e2Arg = (2*n*u - u*omega)/(2*omega*sqrt(p-m));
e2 = erfc(e2Arg);
totalerror = e1+e2;
f= (-1)^(n-1) * deltaH * totalerror;

summ(i) = summ(i) + f;
end
end

end

summ;
plot(1:100,summ); hold on; plot(1:100,deltaHvec,'k');
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900