Question: (Using Matlab please)Given the vector x = [17 ? 3 ? 47 5 29 ? 37 51 ? 7 19], create a script that will

(Using Matlab please)Given the vector x = [17 ? 3 ? 47 5 29 ? 37 51 ? 7 19], create a script that will rearrange this in descending order of the numbers in the vector, with all the negative numbers first. That is, the output should be y = [?3 ? 7 ? 37 ? 47 51 29 19 17 5]. The script should be written to work with a vector of any length. If the value 0 exists in the original vector, then it should be placed along with the negative quantities (it will be first element of the resulting vector). Save this script in a file called rearrange.m.

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!