Question: Problem 4* The aim of this exercise is to write a MATLAB code that test if the input 5 +In(6) n is divisible by 7,

Problem 4* The aim of this exercise is to write a MATLAB code that test if the input 5" +In(6) n is divisible by 7, then the output value is otherwise it returns 0. The code is structured as below function [value] = test (n) en value else value = 0; end end 1. Line 2 should be completed as a. if n/7 = 0; b. if mod(n.7) == 0; c. if mod(n.7) = 0; d. None of the above 2. Line 3 should be completed as a. value = (54n+ln(6*n)/e^2*n; b. value = (54n+log(6*n))/e^2*n; c. value = (54n+log(6*n))/e^(2*n); d. None of the above 3. Test your script with n = 14, then value = a. 0 b. 0.0018 c. 0.0042 d. None of the above Problem 2 for 2:1 Consider the recurrent sequence xp = 0, x3 = 1, Xx==(-1 Xu-2), 122 You will find below a MATLAB function that is written to find the nth term of this sequence. However, this m-file named "Seqreq" includes some mistakes to be detected function [x] - Seqreqin) x(0)-0; x(1)-1; (1)-(1/3)(x(1-1) -x(1-2); end XnEx(n; 1. Mistakes exist in: a. Lines 2, 3. and 5 b. Lines 3 and 4 c. Lines 2.3.4.5 and 7 d. None of the above 2. Line 7 should be replaced by: a. This line is useless, we need to delete it b. xi = x(1) c. xn = x(n+1) d. There are no mistakes in line 7 3. Line 5 should be replaced by: a. x(i)=(1/3)(x(i-1)-x(n-2)); b. x(i)=(1/3)(x(n-1)-(-2)); c. x(i)=(1/3)*(x(i-1)-(i-2)); d. The are no mistakes in line 5 4. Line 4 should be replaced by: a. for i=0:n b. for i = 3: n+1 c. for i=1:n d. There are no mistakes in line 4 5. The value of X10 a. -0.0172 b. 0,0069 c. 0.0080 d. 0.0099
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
