how to write a piecewise function in matlab
See More Methods at
https://www.entechin.com//how-to-plot-a-piecewise-function-in-matlab/
clear all;
close all;
clc;
syms x;
y=piecewise(-5<=x<=0,(2*x)+3, (0<x) & (x<2), x, (2<=x) & (x<=5),1-x);
fplot(y);
xlabel('X-axis')
ylabel('Y-axis')
title('Piecewise Function f(x)')
grid on;