Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Program05.m 1) Create a MATLAB Program titled Program05.m and open the file. 2) Call myPrompt function and store the returned array in retArr, if

image text in transcribedimage text in transcribed

1. Program05.m 1) Create a MATLAB Program titled Program05.m and open the file. 2) Call myPrompt function and store the returned array in retArr, if it is empty then end the program. 3) Call Matrix_Generator function and store the returned array in myMat, if it is empty then end the program. 4) Call Fix_myMat function and store the returned array in new Mat, if it is empty then end the program. 5) Merge sorted myMAT and sorted newMAT arrays in two rows, store it in comp_Mat. 6) Print comp_Mat as shown in the Sample Run. 2. myPrompt.m - Create a MATLAB Program titled myPrompt.m and open the file. Setup a return value called retArr, no need for input arguments. - Prompt the user to input the following: (i) Start limit of the range of numbers to generate matrix, store it in a local variable called min_bound. (must be between -10 and 0) End limit of the range of numbers to generate matrix, store it in a local variable called max_bound. (must be between 1 and 50) (iii) No. of rows for the matrix, store it in a local variable called rows. (must be 1) (iv) No. of columns for the matrix, store it in a local variable called cols. (must be between 1 and 40) Merge ALL the entered values in a 1x4 array, store it in the output argument retArr. Validate ALL the user inputs, if any of the entered numbers is out of range, display an error message on the command window and set retArr to an empty array. 3. Matrix_Generator.m Create a MATLAB Program titled Matrix_Generator.m and open the file. Setup one output argument; call it myMAT, and four input arguments, min_bound, max_bound, rows, cols. - Set seed number to (7). Generate a uniformed random array using rand function using the input arguments, store it in myMAT. - Validate myMAT array, if the number of rows or number of columns is different than the input arguments, display an error message (Invalid myMAT dimensions) on the command window and set myMAT to an empty array. Validate myMAT array, if the minimum number is lower than min_bound or the maximum number is higher than max_bound, display an error message (Invalid myMAT boundaries) on the command window and set myMAT to an empty array. 4. Fix_myMat.m Create a MATLAB Program titled Fix_myMAT.m and open the file. Setup one input argument; call it mat, and one output argument; call it new_mat. Extract all negative numbers from mat array, store them in a local variable called neg_num, round all numbers to the nearest highest whole number. Extract all numbers between 15 and 25 from mat array, store them in another local variable called range_num, round all numbers to the nearest lowest whole number. - Extract all positive numbers those who are less than 15 or greater than 25 from mat array, store them in a third local variable called round_num, round all numbers to a whole number. Merge ALL three local variables in a 1x4 array in the order of neg_num then range_num then round_num, store it in the output argument new_mat. Validate the number of elements and the size of new_mat array, if they are different than the number of elements and the size of the original mat array, then display an error message (Invalid new_mat dimensions) on the command window and set new_mat to empty array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

39 Job evaluation methods.

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago