analytic solution with infinite sum

3 次查看(过去 30 天)
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 个评论
darova
darova 2020-2-23
Can you please write formula in LaTeX format?
Something like this:

请先登录,再进行评论。

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by