www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/PlotPiecewiseExpressionExample.m
%% Plot Piecewise Expression % Plot the following piecewise expression by using |fplot|. % % $$ y = \Bigg\{ \matrix{-2 & x<-2 \cr x & -2<x<2 \cr 2 & x>2}.$$ syms x y = piecewise(x<-2, -2, -2<x<2, x, x>2, 2); fplot(y)