Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The area of a parallelogram in ~2, built on non-parallel vectors v,, v, and the volume of a parallelepiped in , built on vectors v,,
The area of a parallelogram in ~2, built on non-parallel vectors v,, v, and the volume of a parallelepiped in , built on vectors v,, v2, v,, which do not lie in the same plane, is det A (or abs(det A)), where A-[v, v2] and A-[v, v2 v,], respectively. (See Section 3.3 of the textbook for details.) In this exercise, you will be given 2 vectors in ~2, v and v2, or 3 vectors in on which a parallelogram or parallelepiped, respectively, may or may not be built. v,, v,, and v 35 **Create a function in MATLAB: function D areayol(A) which takes as an input a matrix A, whose columns are the vectors on which a parallelogram or parallelepiped may possibly be built. **First, your function has to check whether the given vectors are linearly independent. I recommend using the function rank to verify that. If it is not the case, then a parallelogram in 2 or parallelepiped in 3 cannot be built. In this case, the function (1) outputs a message, which has to be specific about whether a parallelogram or a parallelepiped cannot be built, (2) it also outputs D-0, and the program terminates (the command return) **If the vectors are linearly independent, the function calculates the area or the volume, denoted D, and outputs one of the following messages with the value of D The area of the parallelogram is" (output the area D) or "The volume of the parallelepiped is" (output the volume D) Hint: in order to display a correct message whether it is the area or the volume, you should keep a track on the number of columns of A and use a conditional statement. *Type the function areavol in your diary file **Run the function D-areaval(A) on each of the following matrices (a) A-randi(10,2,2) (b) A-fix(10*rand(3,3)) (c) A-magic(3) (d) B-tandi([-10,101, 2, 1); A-[B, 2*B] (e) X tandi([-10, 101, 3, 1); Y = randi([-10, 101, 3, 1); A = [X, Y, X+Y] Notice: the matrices in (d) and (e) are created by using vectors
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