(Ва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%
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