MATLAB GURU FETEX 2014 (Q.7 with Solution Codes)

Posted on at


Q.7 GENERATING RANDOM PERMUTATION:

Write a MATLAB code that generates a Random Sequence for seating plan of 10 officers in a heading of a seminar. 

Conditions for their seating plans are:

There are exactly 10 fixed positioned chairs on the stage and are numbered in ascending order from left [1] to right [10]. (Code hint: seatNumber=1:10 ;)

Each officer has ID Number, a fixed number from 1 to 10.

Their seating plan is so adjusted that for every seminar a new seating plan is observed which is randomly generated.

Output should look like this: [seatNumber' ; officerNumber']

HINT: Your output must look like the output of randperm (10), built-in function of MATLAB.

NOTE: Don't use randperm function for your code. You may make use of rand(), unique(), sort(). 

Solution:

 

Authored by Shahid Ali Murtza



About the author

160