subject
Engineering, 27.01.2021 09:00 yulimariu27

Selecting random elements from an array. Assign selectedValues with numberSelected randomly selected elements from row array dataSet. Duplicate selections are acceptable. Hint: Use the randi function and an indexing array.
Ex: If numberSelected is 3 and dataSet is (74, 13, 1, 51, 6 ), then selectedValues might return [ 1, 74, 13 ].
Note: Successive "Runs' with the same arguments may return different results due to the random number generation. The ''Submit for Assessment' tests are configured to produce the same random numbers.
Function 0
Save 0 Reset â–  MATLAB Documentation
1 function selectedValues selectRandom( dataSet, numberSelected ) 2 selectRandom: Return numSel elements of input array data selected at 3 % random. Duplicate selections are acceptable. 4 % Inputs: data - array of input data values 5 % numSel - number of randomly selected elements to return 6 % 7 % Outputs: selected - array of randomly selected data values 8 9 % Choose randomly selected elements for output. 10 11 12 end 13
Code to call your function
selectRandom([ 74, 13, 1, 51, 6 ], 3)


Selecting random elements from an array.

Assign selectedValues with numberSelected randomly selec

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:20
Athin walled concentric tube exchanger is used to cool engine oil from 160°c to 60°c with water that is available at 25°c acting as a coolant. the oil and water flow rates are each at 2 kg/s, and the diameter of the inner tube is 0.5 m and the corresponding value of the overall heat transfer coefficient is 250 w/m2. oc. how long must the heat exchanger be to accomplish the desired cooling? cpwater=4.187 kj/kg-candcpengine el=2.035 kj/kg·°c, oil . 120]
Answers: 1
question
Engineering, 04.07.2019 18:20
Apiston-cylinder device contains 0.1 m3 of liquid water and 0.9 m3 of water vapor in equilibrium at 800 kpa. heat is transferred at constant pressure until the temperature of water reaches 350 °c. determine (a) the quality of water at the initial state (b) the work associated with this process, (c) the heat associated with this process.
Answers: 2
question
Engineering, 04.07.2019 18:20
Atank with constant volume contains 2.27 kg of a mixture of water phases (liquid-vapor). in the initial state the temperature and the quality are 127 °c and 0.6, respectively. the mixture is heated until the temperature of 160 oc is reached. illustrate the process in a t-v diagram. then, determine (1) the mass of the vapor in kg at the initial state, (2) the final pressure in kpa.
Answers: 3
question
Engineering, 06.07.2019 02:30
Around steel bar, made from material with a yield stress of 750mpa, is loaded so that it has stresses co locations of maximum normal stress and maximum shear stress. use maximum shear stress and maximum distortion energy theories to calculate the safety factors for initial yielding failures.
Answers: 3
You know the right answer?
Selecting random elements from an array. Assign selectedValues with numberSelected randomly selecte...
Questions
question
Mathematics, 21.01.2021 01:00
question
English, 21.01.2021 01:00
Questions on the website: 13722363