Question: (Matlab) Create a function, myData(x,y), that takes one or two arguments and returns a sum. If only one scalar argument, x, is provided, myData() returns

(Matlab) Create a function, myData(x,y), that takes one or two arguments and returns a sum. If only one scalar argument, x, is provided, myData() returns x + x. If two scalar arguments are provided, myData() returns x + y. However, if vector arguments are provided, myData() returns an elementby-element sum and also plots a graph of the sums.

(Matlab) Create a function, myData(x,y), that takes one or two arguments and

function res = myData(x,y) y=2 ; switch nargin case 0 sum (x) case 1 x-(y/2) x=y-2 *tV 10 - 12 13 14 15 16 - case2 [14] sum (x (y)) plot sum (x (y)) end function res = myData(x,y) y=2 ; switch nargin case 0 sum (x) case 1 x-(y/2) x=y-2 *tV 10 - 12 13 14 15 16 - case2 [14] sum (x (y)) plot sum (x (y)) end

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!