i have written this code i want to solve this heat equation for n vary from 0 to n(any value) for each value of x at each case from t= 0 to 10

syms l t n x pi alpha ;
a=input(('please enter alpha:'));
b=input(('please enter length:'));
c=input(('please enter number:'));
T(x,t)= 200/pi * ((-1)^(n+1))/n * sin (n*pi*x/l)*exp(-((n*pi/t)^2)*t);
symsum( T(x,t), n, 1, n);
this code is not running can any body tel me the right code

Respuestas (1)

Do you want to evaluate this numerically? Such that you have a value for T at each x and t. If so, your approach of using symsum is probably not the best way to go. Instead, I would do something like this:
a = input('please enter alpha:'); %note that this value isn't used anywhere
L = input('please enter length:');
N = input('please enter number:');
x = linspace(0, L, 50); %for example, 50 steps
t = linspace(0, 10, 50);
[X,T] = meshgrid(x,t); %make a big matrix
T = @(n) (200/pi).*(((-1).^(n+1))./n).*sin(n*pi*X/L).*exp(-((n*pi./T).^2).*T); %define T(x,t,n) function
%now you can find T at n=5, for example, using
T(5)

Preguntada:

el 22 de Abr. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by