How to compute the sum of the squares of all integers from 2 to 20 using for-loop?

63 views (last 30 days)
Hey guys i am very new to MATLAB and i am currently in a class and need help with homework! thank you in advance!

Answers (1)

Prasanna Venkateshan
Prasanna Venkateshan on 7 Jul 2020
Edited: Prasanna Venkateshan on 7 Jul 2020

The variable sum contains your output

for i=2:20
  1 Comment
Image Analyst
Image Analyst on 7 Jul 2020
Yes, but sum() is a built-in function that you should not destroy by calling your variable sum. Choose another name, like sumOfSquares or something.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!