How can i Calculate this with matlab?
조회 수: 2(최근 30일)
표시 이전 댓글
Star Strider 2021년 12월 1일
Using the Symbolic Math Toolbox —
alpha = 1;
L = 1;
t = 0.05;
x = 42; % Not Supplied
arg = exp(-(m*pi/L)^2*alpha*t) * (1 - (-1)^m)/(m*pi) * sin(m*pi*x/L)
S = symsum(arg, m, 1, Inf)
Svpa = vpa(S)
I am not certain where the term is supposed to go, so I included it as part ot the exponent argument because it appears to mne that is where it belongs. Change that if I guessed in error.
Experiment to get different results.
댓글 수: 11
Yongjian Feng 2021년 12월 1일
편집: Yongjian Feng 2021년 12월 1일
If the series is convergent, one way is to set a cutoff value (for example epsilon = 0.00000001). Then when you do the sum from m going up, compute each term. If a term is smaller than epsilon (when m is big enough) then stop. Something like this
epsilon = 0.000000001; % this determines how accurate your result is
result = 0;
done = false;
m = 0;
next_term = 0; % Do you calculation here for this m value!!!!
result += next_term; % accumulate
if next_term < epsilon
% the increment is small enough, stop the while loop
done = True;
m += 1; % go to next term
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!