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,v2 and 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=[v1 v2] and A=[ v1 v2 v3 ], respectively.

In this exercise, you will be given 2 vectors in R2, v1 and v2 , or 3 vectors in R3, v1, v2, and v3, on which a parallelogram or parallelepiped, respectively, may or may not be built.

**Create a function in MATLAB:

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 function rank to verify that. If it is not the case, then a parallelogram in R2 or 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 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.

***EXPLAIN HOW YOU CAME UP WITH THE FUNCTION AND THE FUNCTION HAS TO BE D=areavol(A), USE RANK, AND THE RETURN FUNCTION. People have been neglecting explaining and so far their functions don't work either.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions