(Ваndom Matrices) rand_mat_and_entry Function: Input parameters: • two scalars representing the mumber of rows m and columns n of the desired matrix • two scalars representing the minimum and maximum values desired (as flonting point numbers) in the matrix Output parameters: • an m x n matrix A with randomly chosen flonting point entries between the desired minimum and maximum values a scalar which is a randomly sclected entry from the matrix producod (note: to do this, you will have to randomly select a row then a column after producing the matrix or else your random numbers won't matech mine in the autograder) A possible sample case is: > » [mat_A, ran entry] = rand mat and entry(3, 4, 0, 10) mat A = 8.66802 1.66461 8.92578 1.60330 9.12651 7.40808 1.49912 7.37412 0.93661 7.61565 8.95304 3.64944 rand_entry - 7.40808
(Ваndom Matrices) rand_mat_and_entry Function: Input parameters: • two scalars representing the mumber of rows m and columns n of the desired matrix • two scalars representing the minimum and maximum values desired (as flonting point numbers) in the matrix Output parameters: • an m x n matrix A with randomly chosen flonting point entries between the desired minimum and maximum values a scalar which is a randomly sclected entry from the matrix producod (note: to do this, you will have to randomly select a row then a column after producing the matrix or else your random numbers won't matech mine in the autograder) A possible sample case is: > » [mat_A, ran entry] = rand mat and entry(3, 4, 0, 10) mat A = 8.66802 1.66461 8.92578 1.60330 9.12651 7.40808 1.49912 7.37412 0.93661 7.61565 8.95304 3.64944 rand_entry - 7.40808
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
![(Random Matriccs)
rand_mat_and_entry Function:
Input parameters:
• two scalars representing the number of rows m and columns n of the
desired matrix
• two scalars representing the minimum and maximum values desired (as
floating point numbers) in the matrix
Output parameters:
• an m x n matrix A with randomly chosen floating point entries between
the desired minimum and maximum values
a scalar which is a randomly selected entry from the matrix produced
(note: to do this, you will have to randomly select a row then a column
after producing the matrix or else your random numbers won't match
mine in the autograder)
A possible sample case is:
» [mat_A, ran_entry] = rand_mat_and_entry (3, 4, 0, 10)
mat_A =
8.66802
1.66461
8.92578
1.60330
9.12651
7.40808
1.49912
7.37412
0.93661
7.61565
8.95304
3.64944
rand entry = 7.40808](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff610f60e-c097-44c0-9c2f-23e045cb2fc2%2Facf64aaa-320b-450f-8c93-a639fa2c620d%2Fv4fajt_processed.png&w=3840&q=75)
Transcribed Image Text:(Random Matriccs)
rand_mat_and_entry Function:
Input parameters:
• two scalars representing the number of rows m and columns n of the
desired matrix
• two scalars representing the minimum and maximum values desired (as
floating point numbers) in the matrix
Output parameters:
• an m x n matrix A with randomly chosen floating point entries between
the desired minimum and maximum values
a scalar which is a randomly selected entry from the matrix produced
(note: to do this, you will have to randomly select a row then a column
after producing the matrix or else your random numbers won't match
mine in the autograder)
A possible sample case is:
» [mat_A, ran_entry] = rand_mat_and_entry (3, 4, 0, 10)
mat_A =
8.66802
1.66461
8.92578
1.60330
9.12651
7.40808
1.49912
7.37412
0.93661
7.61565
8.95304
3.64944
rand entry = 7.40808
Expert Solution

Step 1
Since no programming language is mentioned, I am using matlab
Code:
[matrix,entry]=rand_mat_and_entry(3,4,0,10)
function [mat_A,ran_entry]=rand_mat_and_entry(r,c,l,u)
mat_A=l+(u-l).*rand(r,c)
ind = ceil(rand * size(mat_A,1));
ran_row = mat_A(ind,:);
ran_entry=ran_row(:,ind)
end
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education