Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB Help: Create a 1 by 15 row vector of random integers between 1 and 20, then create one random integer between 5 and 15.
MATLAB Help:
Create a 1 by 15 row vector of random integers between 1 and 20, then create one random integer between 5 and 15. Sort your vector according to how far away each of its elements is from that scalar integer, in the descending order of the absolute distance. Hint: use the sort() function.
example run:
The original vector is [12 10 1 7 4 16 7 11 4 13 6 14 14 15 10]]
Sorted by the distance away from 5,
from far to near, the new vector is [16 15 14 13 12 11 10 10 1 7 7 4 4 6]
-----
Thank you for the help!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started