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
답변 (1개)
Matt Kindig
2013년 4월 22일
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)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!