I need to calculate the infinite summation of this equation for different values of x, using a for loop

조회 수: 2 (최근 30일)
Hey guys
I need to find the value of T for different value of x. The values of x are stored in an array and the value of t is constant. And k, c and rho are also constant. I tried symsum, but im getting the following error:
Unable to perform assignment because value of type 'sym' is not convertible to 'double'.

채택된 답변

Torsten
Torsten 2023년 2월 23일
L = 1;
n = 1:500;
lambda = (2*n-1)*pi/(2*L);
alpha = 1;
t = 0.1;
x = (linspace(0,L,100)).';
f = (-1).^(n+1)./(2*n-1).*exp(-alpha*lambda.^2*t).*cos(lambda.*x);
T = 4/pi*200*sum(f,2);
plot(x,T)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by