x1 = -6:0.1:-2;
x2 = -2:0.1:3;
x3 = 3:0.1:7;
y1 = -3*ones(size(x1));
y2 = 2*ones(size(x2));
y3 = 5*ones(size(x3));
plot(x1,y1,x2,y2,x3,y3)
title('Piecewise Function')
xlabel('x')
ylabel('g(x)')
grid on
To embed this project on your website, copy the following code and paste it into your website's HTML: