how to calculate Somme of vector elements ?
158 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
diadalina
el 21 de Oct. de 2018
Comentada: mohamed
el 29 de Mzo. de 2024 a las 13:56
i would like to calculate the somme k=1:10^5 of 1/k^2,using the command sum, can anyone help me ?
0 comentarios
Respuesta aceptada
madhan ravi
el 21 de Oct. de 2018
Editada: madhan ravi
el 21 de Oct. de 2018
k=1:10.^5;
sum(1./(k.^2))
6 comentarios
Bruno Luong
el 28 de Oct. de 2018
Editada: Bruno Luong
el 28 de Oct. de 2018
"is there any method to verify the obtained result ?"
s = sum(1./(k.^2))
s / (pi^2/6)
That gives
s =
1.6449
ans =
1.0000
Seems alright to me.
Más respuestas (1)
mohamed
el 28 de Mzo. de 2024 a las 23:25
I need instructions that I write in MATLAB, to give me the result of this sum
2 comentarios
mohamed
el 29 de Mzo. de 2024 a las 13:56
Thanks dude, just forgot to mention that "x" changes from 0 to 2, and t is the time
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!