Clear Filters
Clear Filters

need halp with simbolic summation?

1 view (last 30 days)
d
d on 6 Dec 2016
Commented: Karan Gill on 8 Dec 2016
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 Comment
Karan Gill
Karan Gill on 8 Dec 2016
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.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!