Given a mathematical function as follows y 10e3x 5 for x g
Given a mathematical function as follows:- y = {10(e^-3x + 5), for x greaterthanorequalto 10 log_10 x, for x greaterthanorequalto 0 10, for x
Solution
function y = piecewisefunc(x)
if x < 0
y = 10;
elseif 0<= x & x < 10
y = log10(x);
else
y = 10*((e^(-3x))+5);
end
x = -5 : .01 : 30;
for ix = 1 : length(x)
y(ix) = piecewisefunc(x(ix));
end
plot(x, y)
axis([-5 30 -1000 1000 ])
