how to calculate Somme of vector elements ?
57 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i would like to calculate the somme k=1:10^5 of 1/k^2,using the command sum, can anyone help me ?
0 Commenti
Risposta accettata
madhan ravi
il 21 Ott 2018
Modificato: madhan ravi
il 21 Ott 2018
k=1:10.^5;
sum(1./(k.^2))
6 Commenti
Bruno Luong
il 28 Ott 2018
Modificato: Bruno Luong
il 28 Ott 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.
Più risposte (1)
mohamed
il 28 Mar 2024
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1654846/image.png)
I need instructions that I write in MATLAB, to give me the result of this sum
2 Commenti
mohamed
il 29 Mar 2024
Thanks dude, just forgot to mention that "x" changes from 0 to 2, and t is the time
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!