% 345A plotting demo for piecewise def'd fctn


y1 = @(x) 1-exp(-x); %function handle to function 1
y2 = @(x) (exp(1)-1)*exp(-x); % ditto but for function 2
x1 = [-1:0.1:1]; % partition range for function 1
x2 = [1:0.1:3]; % ditto but for function 2

plot(x1,y1(x1),'m-',x2,y2(x2),'m-') % plot with stunning colors


