Azzera filtri
Azzera filtri

need halp with simbolic summation?

1 visualizzazione (ultimi 30 giorni)
d
d il 6 Dic 2016
Commentato: Karan Gill il 8 Dic 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 Commento
Karan Gill
Karan Gill il 8 Dic 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.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by