Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The area of a parallelogram in R 2 , built on non-parallel vectors v 1 ,v 2 and the volume of a parallelepiped in R

The area of a parallelogram in R2, built on non-parallel vectors v1,v2and the volume of a parallelepiped in R3, built on vectors v1, v2, v3, which do not lie in the same plane, is |det A|(or abs(det A)), where A=[v1v2] and A=[ v1v2v3], respectively.

To be given is 2 vectors in R2, v1and v2, or 3 vectors in R3, v1, v2, and v3, on which a parallelogram or parallelepiped, respectively, may or may not be built.

**How would you create a function in MATLAB for:

function D = areavol(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 functionrankto verify that. If it is not the case, then a parallelogram in R2or parallelepiped in R3cannot 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 commandreturn).

**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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Hard Decisions with decision tools

Authors: Robert Clemen, Terence Reilly

3rd edition

538797576, 978-0538797573

More Books

Students also viewed these Mathematics questions