need halp with simbolic summation?

1 次查看(过去 30 天)
d
d 2016-12-6
评论: Karan Gill 2016-12-8
I solved the laplace equation and I got a discrete vector of coefficients (A_n) with 100 coefs (n=100)
now the solution is looking like this:
U(i,j)=sum(An.*cosh((pi/b*(1/2+n))*z(j)).*sin((pi/b*(1/2+n))*(x(i)-b)));
where x,z are the coordinates and n is the index
now I need to plot it. the straight forward method would be to calculate the sum in each coordinate, using two for loops
for i=1:length(x)
for j=1:length(z)
U(i,j)=sum(An.*cosh(Ln*z(j)).*sin(Ln*(x(i)-b)));
end
end
I dont want to use repmat tools because x,z can get very large and I also want to check for larger n (n=1000, n=10000) so it will consume too much memory.
Is there a different way to do it? I thought maybe to use symbolic? but I dont know how to use symbolic symsum when A_n is a vector and not an expression.
I tried this:
syms x z b
b=0.3;
U=symsum(An(n).*cosh((pi/b*(1/2+n))*z).*sin((pi/b*(1/2+n))*(x-b)), i, 1, 10);
but it didn't work. any suggestions?
  1 个评论
Karan Gill
Karan Gill 2016-12-8
You already have numeric data. Why are you going to symbolic? You are supposed to go the other way. I'd recommend finding a way to optimize your numeric calculations.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by