analytic solution with infinite sum
이전 댓글 표시
Hi,
I am having trouble figuring out how to write the code for this function that contains an infinite series.
Ti = 150;
T1 = 300;
T2 = 200;
L = 1;
alpha = 0.1;
delta_x = 0.05;
delta_t = 0.01;
N_time = 51;
N_space = 21;
x = linspace(0,L,N_space);
t = linspace(0,0.5,N_time);
I need to make the code so that it can compute this:
% I also need a little help in making the function. I have used syms m x t, but it doesn't work all the time.
c_m = (2/m*pi) ((Ti - T1)-(-1)^m*(Ti - T2))
T(x,t) = T1 + (T2 - T1)*(x/L) + %my unknown part: the infinite sum starting from 1 of c_n*exp(-m^2*pi^2*alpha*t/L^2)*sin(m*pi*x/L)
댓글 수: 3
Walter Roberson
2020년 2월 23일
The only function that MATLAB has for working with infinite sums to create an analytic solution, is symsum() from the Symbolic Toolbox.
darova
2020년 2월 23일
Can you please write formula in LaTeX format?
Something like this:
Chien-Cheng Chiu
2020년 2월 23일
답변 (1개)
darova
2020년 2월 23일
Here is my attempt
Ti = 150;
T1 = 300;
T2 = 200;
L = 1;
alpha = 0.1;
delta_x = 0.05;
delta_t = 0.01;
N_time = 51;
N_space = 21;
x = linspace(0,L,N_space);
t = linspace(0,0.5,N_time);
[X,T] = meshgrid(x,t);
cm = X*0;
for m = 1:100
C1 = 2/m/pi*( (Ti-T1)-(-1)^m*(Ti-T2) );
C2 = exp(-m^2*pi^2*alpha*T/L^2).*sin(m*pi*X/L);
cm = cm + C1*C2;
end
surf(X,T,cm)
xlabel('X')
ylabel('T')
카테고리
도움말 센터 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!