Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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',

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions