Question: Can someone please help me with this Matlab problem? Please make sure that the output matches the example of the output in the problem. Thanks!
Can someone please help me with this Matlab problem? Please make sure that the output matches the example of the output in the problem. Thanks!
PROBLEM 3: Modifying and Formatted Vector output (40 points) Write a program according to the following specifications. Unless specified, suppress executing your program should look similar to the output shown below. FIRSTNAME LASTNAME LAB 6 problem 3 Enter the number of elements for a vector v 10 The elements of vector v are 60 23 12 40 12 45 19 49 56 V contains 2 prime numbers V contains 1 multiples of 3 in the range (25 55) After updating the multiples of 3 V now contains 40 10 12 19 49 52 56 (a) Create a variable named N and assign to it an integer obtained by prompting the user to enter the size of a row vector Assume the user always enters a positive integer (b) Create a variable named Vand assign to it an N-element row vector whose elements are randomly generated integers uniformly chosen from the closed interval 10, 75] (c) Declare another for end statement with a loop-variable named k that will be assigned to every element of a row vector whose elements represent the indices/positions of row vector V In the body of this for-end statement, perform the following: Count the number of prime numbers contained in row vector Use the built-in function isprime. Count the number of elements ofrow vector Vthat are multiples of 3 (i.e evenly divisible by 3), greater than 25, but less than 55 Multiply (and update) each of the elements in vector V that are only multiples of 3 by two times the negative of their index/position within row vector V (d) Using multiple instances of the built-in fprintf function, display the following: Number of prime numbers contained in Format the number as an integer. Number of multiples of 3 contained in Vin the range (25, 55). Format the number as an integer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
