Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Need help in code triple summation with conditions.

1 Ansicht (letzte 30 Tage)
Chee Hao Hor
Chee Hao Hor am 25 Apr. 2019
Geschlossen: Walter Roberson am 25 Apr. 2019
Good day,
I am solving the temperature profile that involved one, two and three summation, denoted as T, T1 and T2 in a single analytical solution, respectively. Matlab solved the one and two summation terms in less than 3 minutes time. However, when it comes to solving the three summation term,T2, it run for 12 hours continouosly still could not give me a solution. Could anybody can help me ? Hereby with the attachment of the code.
syms n
y = [0:0.01:1];
b =1; t=1; br=1; Pr=1;
C1=((1-(-1)^n)/(2*n*pi))*((1-exp(-(n*pi)^2 *t ))/(n*pi)^2 +((n*pi)^2*exp(-(n*pi)^2*t)-((n*pi)^2*cos(2*b*Pr*t))-(2*b*Pr*sin(2*b*Pr*t)))/((4*b^2*Pr^2)+(n*pi)^4 ));
T= symsum ((2*br*C1*sin(n.*pi.*y)),n,1,2);
double(T)
syms n M
y = [0:0.01:1];
b =1; t=1; Pr= 1; br=1;
C2=(((M.*pi).^2./((8.*b.^2.*Pr.^2)+2.*(n.*pi).^4)).*( (2.*b.*Pr.*exp(-(n.*pi).^2.*t))+((n.*pi).^2.*sin(2.*b.*Pr.*t))- (2.*b.*Pr.*cos(2.*b.*Pr.*t))));
C3=-((b./((8.*(n.*pi).^2.*b.^2.*Pr.^2)+ (2.*(n.*pi)^6))).*( (4.*b.^2.*Pr.^2.*exp(-(n.*pi).^2.*t))+ (2.*b.*Pr.*(n.*pi).^2.*sin(2.*b.*Pr.*t))+((n.*pi).^4.*cos(2.*b.*Pr.*t))-(4.*b.^2.*Pr.^2)-(n.*pi).^4 ));
C4=(((M.*pi).^2./(Pr.^2.*((M.*pi).^4+ b.^2 ))).* ( (b.*Pr.*exp(-(n.*pi).^2.*t))- exp(-(M.*pi).^2.*Pr.*t).*((((M.*pi).^2.*Pr-(n.*pi).^2).*sin(b.*Pr.*t))+ (b.*Pr.*cos(b.*Pr.*t)) )));
A = (2.*b./(b.^2+(M.*pi).^2)).* (((1-cos((n+M).*pi))./((n+M).*pi)) + ((1-cos((n-M).*pi))./((n-M).*pi))).*(C2+C3+C4).*sin(n.*pi.*y);
Az = piecewise( ((n-M).*pi) == 0 , 0, A);
T1 = symsum( symsum( 2.*br.*Az,M , 1, 2), n, 1, 2);
double(T1)
syms n M N
y = [0:0.01:1];
b= 1; t=1;Pr=1; br=1;
C5=(((M.*N.*pi.^2 ).^2./((8.*b^2.*Pr.^2.*(n.*pi).^2 )+ (2.*(n.*pi).^6))).*((2.*b.*Pr.*(n.*pi).^2.*sin(2.*b.*Pr.*t))+((n.*pi).^4.*cos(2.*b.*Pr.*t))+(4.*b.^2.*Pr.^2)+(n.*pi).^4-(exp(-(n.*pi).^2.*t).*(4.*b.^2.*Pr.^2+2.*(n.*pi).^4 ))));
C6=(((b.*(M.*pi).^2)./((8.*b.^2.*Pr.^2)+ (2.*(n.*pi).^4))).*(((n.*pi).^2.*sin(2.*b.*Pr.*t))- (2.*b.*Pr.*cos(2.*b.*Pr.*t))+ (2.*b.*Pr.*exp(-(n.*pi).^2.*t))));
B1 = (b.^2./(((b.^2)+(M.*pi).^2).*((b.^2)+(N.*pi).^2))).*(((1-cos((n+M+N).*pi))./((n+M+N).*pi))+((1-cos((n-M-N).*pi))./((n-M-N).*pi))+((1-cos((n+M-N).*pi))./((n+M-N).*pi))+((1-cos((n-M+N).*pi))./((n-M+N).*pi)));
B1z = piecewise( ((n-M-N).*pi) == 0 , 0,((n+M-N).*pi) == 0 , 0,((n-M+N).*pi) == 0 , 0, B1);
T2 = symsum( symsum( symsum( 2.*br.*B1z.*(C5+C6).*sin(n.*pi.*y),N , 1, 2), M, 1, 2), n, 1, 2);
double (T2)

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by