Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(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.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started