IF YOU DO NOT HAVE MATLAB YOU CAN HAND WRITE THE SCRIPT Writ
IF YOU DO NOT HAVE MATLAB YOU CAN HAND WRITE THE SCRIPT
Write Matlab scripts to calculate the sum of the following series. You need use the while loop to solve this problem. No use of Matlab built-in functions is allowed. Use two forms of the while loop: while (condition), and while (1) or infinite loop. 11 + 21 + 31 + _______ + 191 9 + 12 + 15 + 18 _______ 35 Terms 2 + 5 + 11 + 23 + 47 + _______ 30 terms while end while (1) endSolution
Matlab Code
a)
tmp = 11;
 output = 0;
 while(tmp <=191)
 output = output + tmp;
 tmp = tmp + 10;
 end
 output
b)
tmp = 9;
 output = 0;
 n = 1;
 while(n<=35)
 output = output + tmp;
 tmp = tmp +3;
 n = n+1;
 end
 output
c)
tmp = 2;
 output = 2;
 n = 1;
 while(n<30)
 n = n+1;
 tmp = (2*tmp) + 1;
 output = output + tmp;
 end
 output

