Question: 1. m 2. Write a function with header [f] = myMultOperation(a,b,oper- ation). The input argument, oper- ation, is a string that is either plus', 'minus',

1. m 2. Write a function with header [f] = myMultOperation(a,b,oper- ation). The input argument, oper- ation, is a string that is either plus', 'minus', 'mult', 'div', or 'pow', and f should be computed as a+b, a-b, a*b, a/b, and ab for the respective values for operation. Be sure to make your function vectorized. Hint: Use the strcmp function. Test Cases: Page 75 of 299 31% >> x = [1 2 3 4]; >> y = [2 3 4 5); >> f = myMultOperation (x, y, 'plus') 3 5 7 9 >> f = myMultOperation (x, y, 'minus') f = - -1 -1 -1 -1 >> f = myMultOperation (x, y, 'mult') f = 2 6 12 20 >> f = myMultOperation (x, y, 'div') 0.8000 0.5000 0.6667 0.7500 >> f = myMultOperation (x, y, 'pow') f = 1024
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
