Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this code, you will be creating the function min2 which evaluates the minimum

ID: 3167413 • Letter: I

Question

In this code, you will be creating the function min2 which evaluates the minimum value of a 2 element vector.

Inputs:

Vector - A vector that contains two elements within it.

Outputs:

Minimum - The minimum value within Vector.

Process:

Step 1:Make Minimum equal the first value of the input vector.

Step 2:If the second value of the vector is less than Minimum, make Minimum equal the second value of the input vector.

Note: The following functions are banned in this exercise: min, max, sort, elseif, else.

Function Template:

function Minimum = min2(Vector)

%INSERT CODE

end

Explanation / Answer

function Minimum = min2(vector)
Minimum = vector(1);
if (vector(2) < Minimum)
Minimum = vector(2);
end
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote