Filter löschen
Filter löschen

need halp with simbolic summation?

1 Ansicht (letzte 30 Tage)
d
d am 6 Dez. 2016
Kommentiert: Karan Gill am 8 Dez. 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 Kommentar
Karan Gill
Karan Gill am 8 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by