Illustration of indexing, MATLAB in Statistics

Assignment Help:

Illustration of Indexing:

Though, rather than of creating the index vector manually as shown here, the process to initialize the index vector is use to a sort function. The algorithm is as shown below:

  •  Initialize the values in index vector to be the indices 1,2, 3, ....
  •  Use any of the sort algorithm, but compare the elements in the original vector by using the index vector to index into it (example, using grades (grade_index(i))).
  •  Whenever the sort algorithm calls for replacing values, replace the elements in the index vector, not in the original vector.

The function which implements this algorithm is as shown below:

1481_Illustration of Indexing.png

For illustration, for the grades vector as given:

>> clear grade_index

>> grade_index = createind(grades)

grade_index =

2 5 1 6 4 3

>> grades(grade_index)

ans =

70 80 85 91 95 100


Related Discussions:- Illustration of indexing

Rectangle - graphics objects, Rectangle - graphics objects: The other ...

Rectangle - graphics objects: The other core graphics object is the rectangle that can have curvature added to it (!!). Merely calling the function rectangle without any argum

Function sortrows - sorting strings, function sortrows - sorting strings: ...

function sortrows - sorting strings: The function sortrows sorts each and every row as a block, or group, and it also will work on numbers. Here in this illustration the rows

Combining nested for loops and the if statements, Combining Nested FOR Loop...

Combining Nested FOR Loops and the IF Statements: The statements inside a nested loop can be any of the valid statement, involving any selection statement. For e.g., there can

Illustration of nested loops, Illustration of Nested loops: Running th...

Illustration of Nested loops: Running the script shows the output: >> printstars ***** ***** ***** The variable rows identifies the number of rows to print, and

Example of vectorizing, Example of Vectorizing: Likewise, for an opera...

Example of Vectorizing: Likewise, for an operation on a matrix, a nested loop would be needed; for illustration, supposing a matrix variable mat: [r c] = size(mat); for

Opening and closing a file, Opening and Closing a File: The Files are ...

Opening and Closing a File: The Files are opened with the fopen function. By the default, fopen function opens a file for reading. If the other mode is preferred, a permission

Vectors of nested structures, Vectors of nested structures: The Combin...

Vectors of nested structures: The Combining vectors and nested structures are possible to have a vector of structures in which several fields are structures themselves. Here i

Statistics, Statistics There are numerous statistical analyses which ca...

Statistics There are numerous statistical analyses which can be executed on data sets. In MATLAB software, the statistical functions are in the data analysis help topic known a

Location of a rectangle - graphics objects, Location of a rectangle - graph...

Location of a rectangle - graphics objects: The location of a rectangle is [x y w h], where x and y are the coordinates of the lower left point, here w is the width, and h is

Example of nested functions, Example of Nested functions: For illustra...

Example of Nested functions: For illustration, the function below computes and returns the volume of a cube. Three arguments are then passed to it, for the width and length of

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd