Question: MATLAB QUESTION Loop + Conditional Statement Write a function called piecewise. It should take one input, an array of x values, and have one output,
MATLAB QUESTION Loop + Conditional Statement
Write a function called piecewise. It should take one input, an array of x values, and have one output, an array of y values.
It should implement the following piecewise function on all x values:
When x <= -1, y = log(abs(x))
When -1 < x < 0, y = abs(x)
When 1 > x >= 0,y = x
When x >= 1. y = log(x)
Where log is the natural log.
Assume that x and y are row arrays.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
