Question: In Matlab: Write a user-defined function that sorts the elements of a vector from the largest to the smallest.For the function name and arguments, use

In Matlab:

Write a user-defined function that sorts the elements of a vector from the largest to the smallest.For the function name and arguments, use y = downsort(x). The input to the function is a vector x of any length, and the output y is a vector in which the elements of x are arranged in a descending order.

DO NOT use the MATLAB built-in functions sort, max, or min.

Test your function on a vector with 14 numbers (integers) randomly distributed between 30 and 30.

Use the MATLAB randi function to generate the initial vector.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!