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

3 次查看(过去 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