Question: Write a MATLAB function that will be called like this: Z = smart_math(X,Y) Assume the input variables X and Y are defined as lists of

Write a MATLAB function that will be called like this: Z = smart_math(X,Y) Assume the input variables X and Y are defined as lists of numbers. The return value of the function should be a list of values named Z, where each value of Z is calculated by using the corresponding values of X and Y according to this equation:

Notes:

Use element-by-element operations - Z should have the same number of elements that X and Y have.

Your code must work for any valid lists of numbers.

You do NOT have to use a loop for this problem.

Example Test Case: X = [4 23.1 61 3]; Y = [3 2 1 .5]; Z=smart_math(X,Y); should have an output Z = [5.4777 11.5806 1.0164 1.6261];

Do not include any test cases in the code you submit.

Assume X and Y are row vectors of equal length.

Be sure to define and end your function properly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!