sum of series. Vectorised (no loop)
古いコメントを表示
採用された回答
その他の回答 (2 件)
Mohammad Ali
2021 年 4 月 27 日
1 件のコメント
DGM
2021 年 4 月 27 日
This only gives the correct answer for odd inputs.
You can calculate the sum of a finite alternating harmonic series easy enough:
N = 1000;
n = 1:N;
s = sum((2*mod(n,2)-1)./n)
gives
s =
0.6926
カテゴリ
ヘルプ センター および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!