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
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
darova 2020년 2월 23일
Can you please write formula in LaTeX format?
Something like this:
Chien-Cheng Chiu
Chien-Cheng Chiu 2020년 2월 23일

댓글을 달려면 로그인하십시오.

답변 (1개)

darova
darova 2020년 2월 23일

0 개 추천

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')

카테고리

태그

질문:

2020년 2월 23일

답변:

2020년 2월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by