Question: The coding language is MATLAB No additional information is available. All given instruction has been provided for what to program into MATLAB 1. Program05.m 1)







The coding language is MATLAB
No additional information is available. All given instruction has been provided for what to program into MATLAB
1. Program05.m 1) Create a MATLAB Program titled Program05 m and open the file. 2) Call my Prompt function and store the returned array in retAm, if it is empty then end the program 3) Call Matrix Generator function and store the returned array in my Mat, if it is empty then end the program 4) Call Fix myMat function and store the returned array in new Mal, if it is empty then end the program 5) Merge sorted myMAT and sorted new MAT 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 ret Arr, no need for input arguments Prompt the user to input the following: Start limit of the range of numbers to generate matrix, store it in a local variable called min bound. ( 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 my MAT Validate myMAT array, if the number of rows or number of columns is different than the input arguments, display an error message (Invalid my MAT 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 MAT boundaries) on the command window and set myMAT to an empty array. - 4. Fix_my Mat.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 mal dimensions) on the command window and set new_mat to empty array Sample Run 1: Enter min. bound between -10 and 0): -4 Enter max. bound between 1 and 50): 30 Enter number of rows (must be 1): 2 Enter number of cols (between 1 and 40): 20 Invalid rows !! >> Sample Run 2: Enter min. bound between -10 and 0): 5 Enter max. bound between 1 and 50): 20 Enter number of rows (must be 1): 1 Enter number of cols (between 1 and 40): 40 Invalid min bound !! Sample Run 3: Enter min. bound (between -10 and 0): -5 Enter max. bound (between 1 and 50): 0 Enter number of rows (must be 1): 1 Enter number of cols (between 1 and 40): 20 Invalid max bound !! Sample Run 4: Enter min. bound (between -10 and 0): -5 Enter max. bound (between 1 and 50): 50 Enter number of rows (must be 1): 1 Enter number of cols (between 1 and 40): 40 -3.6305 -3 -1.3735 -1 -1.0372 -1 -0.8030 0 2.3243 2 6667 8 10 7.6667 9.7641 10.1827 10.8480 10 11 12.2697 12 15.1240 15 15.4812 15 15.9518 15 19.1125 19 19.8668 19 20.7264 20 21.2571 21 21.9921 21 22.4935 22 22.5616 22 23.7877 23 24.6173 24 25.1669 25 32.3576 32 34.7906 35 36.2725 36 37.2756 37 37.8955 38 39.2056 39 41.0855 41 45.0021 45 45.0276 45 46.2163 46 47.2571 47 48.7894 49
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
