subject
Engineering, 02.11.2019 04:31 kekebaby156

Create a function called randmatrix that takes input from the script and returns a mxn matrix v of random numbers (use rand). m and n must be chosen by the user on the script and passed to the function. display this matrix on the script.

use for loops to move through the v matrix, element by element, and change any value that is less than 0.5

to 0 and any value that is greater than (or equal to) 0.5 to 1.

display this matrix.

sample output:

enter number of rows: 3

enter number of columns: 5

original matrix v:

0.7275 0.7490 0.2483 0.9199 0.9567

0.5003 0.7374 0.3838 0.9002 0.6681

0.5233 0.8743 0.7914 0.7079 0.4669

new matrix v:

1 1 0 1 1

1 1 0 1 1

1 1 1 1 0

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
During a steady flow process, the change of energy with respect to time is zero. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:10
An air compression refrigeration system is to have an air pressure of 100 psia in the brine tank and an allowable air temperature increase of 60°f for standard vapor compression cycle temperatures of 77 f entering the expansion cylinder and 14 f entering the compression cylinder, calculate the coefficient of performance a. 2.5 b 3.3 c. 4.0 d. 5.0
Answers: 3
question
Engineering, 04.07.2019 19:10
Asteam is contained in a rigid tank with a volume of 1 m3. initially, the pressure and temperature are 7 bar and 500 oc, respectively. the temperature drops due to cooling process. determine: (1) the temperature at which condensation begins in °c, (2) the fraction of the total mass that has condensed when the pressure decreased to 0.5 bar. (3) the volume in m3 occupied by saturated liquid at the final state?
Answers: 3
question
Engineering, 04.07.2019 19:10
Air inially occupying a volume of 1 m2 at 100 kpa, 27 c undergoes three internally reversible processes in series. process 1-2 compression to 500 kpa during which pv constant process 2-3 adiabatic expanslon to 100 kpa process 3-1: constant-pressure expansion to 100 kpa (a) calculate the change of entropy for each of the three processes. (b) calculate the heat and work involved in each process. (c) is this cycle a power cycle or refrigeration cycle?
Answers: 3
You know the right answer?
Create a function called randmatrix that takes input from the script and returns a mxn matrix v of r...
Questions
question
Mathematics, 09.01.2021 14:00
question
Mathematics, 09.01.2021 14:00
question
Physics, 09.01.2021 14:00
question
Physics, 09.01.2021 14:00
question
Mathematics, 09.01.2021 14:00
question
Social Studies, 09.01.2021 14:00
question
Physics, 09.01.2021 14:00
question
English, 09.01.2021 14:00
question
Mathematics, 09.01.2021 14:00
Questions on the website: 13722367