Matlab 绘制分段函数图像

2025-03-18 20:36:25
推荐回答(2个)
回答1:

function func_baidu_56568133
x=-200:200;

y = (x<0).*(x.^2+(1+x).^(1/4)+5)...
+(x==0).*0 ...
+(x>0).*(x.^2+(1-x).^(1/4)-5);

figure(1);
plot(x,y)

fh = @func_baidu_56568133_inner;

figure(2);
fplot(fh,[-200 200])

function y=func_baidu_56568133_inner(x)

y = (x<0).*(x.^2+(1+x).^(1/4)+5)...
+(x==0).*0 ...
+(x>0).*(x.^2+(1-x).^(1/4)-5);

回答2: