Create a matlab function named sumprod prompts the user to


Part 1:

Create a MATLAB function named sumprod that meets the following specifications:

• It accepts three input arguments and returns two output arguments.

• The first output argument is the sum of the three inputs. The second output is the product of the three inputs.

• The function itself should be silent, i.e., it should not prompt the user for input nor should it print anything.

Part 2:

Write a MATLAB script named testps that performs the following tasks:

• Prompts the user to enter the number of times N to repeat a loop.

• Calls your sumprod function within a for loop with the following properties:

o The loop executes for N iterations, starting at 1 with an increment of 1.

o If the looping variable's value is even, sumprod is called with these arguments:

1) Input argument 1 = looping variable

2) Input argument 2 = looping variable * 3

3) Input argument 3 = looping variable ^ 2

o If the looping variable's value is a multiple of three, sumprod is called with these arguments:

1) Input argument 1 = looping variable + 5

2) Input argument 2 = looping variable / 2

3) Input argument 3 = looping variable o If the loop variable's value is neither of the above cases, then the input arguments are all zero.

o Display the output at each iteration using the fprintf function

Request for Solution File

Ask an Expert for Answer!!
MATLAB Programming: Create a matlab function named sumprod prompts the user to
Reference No:- TGS02881954

Expected delivery within 24 Hours