修改fun.m文件
function y = fun(x)
if(x>=0&x<=1/2)
y=2*x;
elseif(x>1/2&x<=1)
y=2*(1-x);
end
end
在Command Window里输入:
fh = @fun;fplot(fh,[0 1]);
修改fun.m文件
function y = fun(x)
if(x>=0&x<=1/2)
y=2*x;
elseif(x>1/2&x<=1)
y=2*(1-x);
end
end
2.在Command Window里输入:
fh = @fun;fplot(fh,[0 1]);