analytic solution with infinite sum

3 ビュー (過去 30 日間)
Chien-Cheng Chiu
Chien-Cheng Chiu 2020 年 2 月 23 日
回答済み: darova 2020 年 2 月 23 日
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:
Chien-Cheng Chiu
Chien-Cheng Chiu 2020 年 2 月 23 日

サインインしてコメントする。

回答 (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 Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by