Question: USE MATLAB! USE MATLAB! QUESTION 3a: Write a function classify that will receive a 1 x n vector as an input argument, and will return:
USE MATLAB!



USE MATLAB!
QUESTION 3a: Write a function "classify that will receive a 1 x n vector as an input argument, and will return: (1) the average of all the negative even integers and (2) the average of all the positive odd integers. Use only loops and if statements. Note: built-in functions such as mean" and "sum are not allowed. QUESTION 3b: Test the function you created in 3a by writing a simple script that inputs a vector that consists of 15 random integers from -10 to 10 and calls the function "classify (You do not have to use the "input" and "fprintf" statements for question 3b). QUESTION 4: Write a function smallest that will receive an m x n matrix as an input argument, and will return the smallest number in the matrix. Use only loops and if statements. You are allowed to use the "size" or "length built-in function. The function would work for any matrices. Note: Other built- in functions such as min, max", "mean, sum", "find" etc. are not allowed. Start with the function definition show below. function y = smallest (A) X Y = SMALLEST(A) returns the smallest number in the matrix A end In a separate script file, test the function by evaluating A given below using the smallest function 2.67 0.2 1 1.3 0.1 0.19 4 8 A= 7.5 2.3 2 4.8 0.12 0.5 0.09 5.1 Submit the m-file for smallest.m and the html report (pdf version) of the separate script file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
