Question: Matlab Problem 5: Write a function piecewise2d.m to compute the following 2-dimensional function f(x,y) x +4y forr 20 y>0 x - 4y for >0 yso
Problem 5: Write a function piecewise2d.m to compute the following 2-dimensional function f(x,y) x +4y forr 20 y>0 x - 4y for >0 yso Set f to be zero for other conditions of x and y. Function piecewise2d.m should have the function declaration : function f = piecewise2d(x,y) where x and y are number inputs and f is a number output. Remember to include a description for the function. Use if elseif statements. (a) Set p5a=evalc('help piecewise2d') (b) Set p5bzpiecewise2d (2.2) (c) Set p5piecewise2d(2,-2) (d) Set p5d-piecwise2d(-2,2) (e) Set p5-piecewise2d(-2,-2) (f) Set p5f_piecewise2d(0.0) (g) Set p5g= (h) Set p5h-piecewise2d(0,-2) (i) Set p5i-piecewise2d (2,0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
