Matlab Programming 1 Use for loop to determine the sum of th
Matlab Programming
1. Use for loop to determine the sum of the first 20 terms of the series 3k^2 - 2
Solution
MATLAB code:
clear all
 close all
 clc
 sum=0;
 for k=1:20
 x=3*power(k,2)-2;
 sum=sum+x;
 end
 sum
sample output
sum =
8570
>>

