I've been trying to estimate this expression with while loop

Answers (1)

There is no need to use a slow while loop when you can use much faster vectorized code:
N = 1:100;
X = sqrt(12*sum((-1).^(N+1)./N.^2))

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 14 Sep 2015

Answered:

on 14 Sep 2015

Community Treasure Hunt

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

Start Hunting!