matlab help Write a script that determines the following su

matlab help :

Write a script that determines the following sum (for all odd n from 3 to 13) using a for loop: y = sigma 2^n+2/n-1

Solution

Solution:

y = 0;
for n = 3 : 2 : 13
   y = y + ( 2 ^ ( n + 2 ) / ( n - 1 ) );
end
disp( y );

[OR]


y = 0;
for n = 3 : 2 : 13
   y = y + ( ( 4 * 2 ^ n ) / ( n - 1 ) );
end
disp( y );

OUTPUT: 3939.2

Second solution time complexity is less compare to first one

Because, time taken to calculate ( 2 ^ ( n + 2 )) is more, Thats way I\'m simplify that as: ( 4 * ( 2 ^ n ))

matlab help : Write a script that determines the following sum (for all odd n from 3 to 13) using a for loop: y = sigma 2^n+2/n-1SolutionSolution: y = 0; for n

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site