Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (6 points) A vector is given by x = [9, 4,0,7]. Write a MATLAB program (a3q4.m) that creates the vector x, then creates a
4. (6 points) A vector is given by x = [9, 4,0,7]. Write a MATLAB program (a3q4.m) that creates the vector x, then creates a matrix M from this vector. The matrix M has four rows, as follows: The original vector, X The reciprocal of x The factorial of the elements in x computed using the myFactorial function from the last question The factorial of the elements in x computed using MATLAB's factorial function. Output the matrix M, with a ruler line above and below. For the numeric output, use MATLAB's fprintf function, creating the four lines of output in a single statement that executes once. For each value, use a field width of 15 characters, including 4 decimal places. The following is the desired output: --------------- --------------- --------------- 9.0000 0.1111 362880.0000 362880.0000 4.0000 0.2500 24.0000 24.0000 0.0000 Inf 1.0000 1.0000 7.0000 0.1429 5040.0000 5040.0000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started