Help with MATLAB problem

13 vues (au cours des 30 derniers jours)
john doe
john doe le 11 Nov 2016
Modifié(e) : per isakson le 11 Nov 2016
The problem is listed below. If anyone could provide me some guidance, I would greatly appreciate it, I kind of don't know where to start!
*"Create a new script file called LASTNAME_LAB6_problem4.m. Again, begin by printing both your name and a title at the beginning of code using the DISP command.
A vector is given by
x=[4.5 5 -16.12 21.8 10.1 -16.11 5 14 -3 3 2]
Using conditional statements and loops, write a program that implements “Selection Sort” to rearrange the elements of x in order from the smallest to the largest. Do NOT use MATLAB’s built-in function sort().
Selection Sort Suppose x is an array of n values. We want to sort x in ascending order. That is, x[1] should be the smallest and x[n] should be the largest. The idea of Selection Sort is that we repeatedly find the smallest element in the unsorted part of the array and swap it with the first element in the unsorted part of the array. "*
  1 commentaire
Guillaume
Guillaume le 11 Nov 2016
By help you mean "do it for me because I can't be bothered and I'd rather cheat on my assignment"?
Otherwise, you would be asking a specific question about the attempt that you made.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by