Menu

(Solved) : Please Answer Parts Question 5 Please Write Answers Part Completion Task Also Posted Every Q43963209 . . .

5. This problem requires coding in MATLAB. You can obtain it from here. 1 2 (a) Execute Sum N.m. This file compute the sum

PLEASE ANSWER ALL PARTS OF QUESTION #5. PLEASE WRITE THEANSWERS TO EACH PART AFTER THE COMPLETION OF THE TASK. IHAVE ALSO POSTED EVERYTHING THAT THE QUESTION REFERS TO — THEGIVEN CODES AND EQ.1.

THE give SUM_N.m code:

2 4 - sum_N. mx + % This program compute the sum from 1 to N (an positive interger). % To execute, for instance for N=100, ty

The given Fibonacci_N.m code:

2 sum_N.m x Fibonacci_N.m x + % This program compute the N-th term of the Fibonacci sequence. function E_N = Fibonacci_N(N) t

Part b refers to Eq. 1 — this is Eq. 1:

Fo=0; Fi = 1; Fn = Fn-1 + Fn-2 for n > 2.

5. This problem requires coding in MATLAB. You can obtain it from here. 1 2 (a) Execute ‘Sum N.m’. This file compute the sum from 1 to N. Check the .m file its detail, including how to run. We always keep tract of the execution time as a bench mark. Try N = 109. Most computers should be able to finish in a few seconds. (b) Compute F1000 in the Fibonacci sequence, using Fibonacci_N.m? Fill up the lines from the iterative formula Eq. (1). (c) How about F10000? If your code is right, the result should exceed the capacity of double precision floating point format supported by MATLAB. Actually, executing ‘realmax’ in the command line returns the largest number supported in MAT- LAB (it’s obviously a very big number for most applications). Find out the largest index of Fibonacci sequence that can be computed by MATLAB on your computer. 2 4 – sum_N. mx + % This program compute the sum from 1 to N (an positive interger). % To execute, for instance for N=100, type ‘sum_N(100)’ and press ENTER. function sum = sum_N(N) tic; % start the stop watch for the execution time sum = 0; % initial sum for i = 1:N % this says the counter i goes from 1 to N sum = sum + i; end ExeTime = toc; % terminate the stop watch % check documentation of ‘fprintf’ for details. fprintf(‘The sum from 1 to %d is %d. The execution time is %d.n’,N, sum, ExeTime); end 2 sum_N.m x Fibonacci_N.m x + % This program compute the N-th term of the Fibonacci sequence. function E_N = Fibonacci_N(N) tic; % start the stop watch for the execution time ??? % initial value(s) for i = 1:N % this says the counter i goes from 1 to N 72? % iteration end ExeTime = toc; % terminate the stop watch % check documentation of ‘fprintf’ for details. fprintf(‘The %dth term of Fibonacci sequence is %d. The execution time is %d.n’,N, F_N, end Fo=0; Fi = 1; Fn = Fn-1 + Fn-2 for n > 2. Show transcribed image text 5. This problem requires coding in MATLAB. You can obtain it from here. 1 2 (a) Execute ‘Sum N.m’. This file compute the sum from 1 to N. Check the .m file its detail, including how to run. We always keep tract of the execution time as a bench mark. Try N = 109. Most computers should be able to finish in a few seconds. (b) Compute F1000 in the Fibonacci sequence, using Fibonacci_N.m? Fill up the lines from the iterative formula Eq. (1). (c) How about F10000? If your code is right, the result should exceed the capacity of double precision floating point format supported by MATLAB. Actually, executing ‘realmax’ in the command line returns the largest number supported in MAT- LAB (it’s obviously a very big number for most applications). Find out the largest index of Fibonacci sequence that can be computed by MATLAB on your computer.
2 4 – sum_N. mx + % This program compute the sum from 1 to N (an positive interger). % To execute, for instance for N=100, type ‘sum_N(100)’ and press ENTER. function sum = sum_N(N) tic; % start the stop watch for the execution time sum = 0; % initial sum for i = 1:N % this says the counter i goes from 1 to N sum = sum + i; end ExeTime = toc; % terminate the stop watch % check documentation of ‘fprintf’ for details. fprintf(‘The sum from 1 to %d is %d. The execution time is %d.n’,N, sum, ExeTime); end
2 sum_N.m x Fibonacci_N.m x + % This program compute the N-th term of the Fibonacci sequence. function E_N = Fibonacci_N(N) tic; % start the stop watch for the execution time ??? % initial value(s) for i = 1:N % this says the counter i goes from 1 to N 72? % iteration end ExeTime = toc; % terminate the stop watch % check documentation of ‘fprintf’ for details. fprintf(‘The %dth term of Fibonacci sequence is %d. The execution time is %d.n’,N, F_N, end
Fo=0; Fi = 1; Fn = Fn-1 + Fn-2 for n > 2.

Expert Answer


Answer to PLEASE ANSWER ALL PARTS OF QUESTION #5. PLEASE WRITE THE ANSWERS TO EACH PART AFTER THE COMPLETION OF THE TASK. I HAVE A…

OR