|
CODE:
Plot[Piecewise[{{x^2, x < 0}, {x, x > 0}}], {x, -2, 2}]
方法二:CODE:
f[x_] := x^2; x < 0
f[x_] := x; x > 0
Plot[f[x], {x, -1, 1}]
GMT+8, 2024-11-28 08:06 , Processed in 0.037918 second(s), 16 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.