This is a MATLAB question I need the exact answer so please
This is a MATLAB question
I need the exact answer... so please double check with your MATLAB !!
1. Write a script to compute:
(a) Using a for/end loop, but not array operators or sum.
(b) Using array operators and sum, but not for/end loop.
(c) Print the calculated value of S
10 n n n= 1 ARSolution
Here is the code for you:
%(a) Using a for/end loop, but not array operators or sum.
s = 0.0;
for i = 1 : 10
%fprintf(\'%d\\t\', i);
s = s + (i+1) / i;
end
fprintf(\'The result of the summation is: %f\ \', s);
%(b) Using array operators and sum, but not for/end loop.
A = 1 : 10;
B = (A+1)./A;
%disp(B);
%S = sum(B);
fprintf(\'The result of the summation is: %f\ \', sum(B));
