代码:
x=linspace(-5,5,100);
y=[];
for x0=x;
if x0>0
y=[y,1/2*log(x0+sqrt(1+x0.^2))];
else
y=[y,(x0+sqrt(pi))/exp(2)];
end
end
plot(x,y)
结果:
代码:
x=linspace(-5,5,100);
y=[];
for x0=x;
if x0>0
y=[y,1/2*log(x0+sqrt(1+x0.^2))];
else
y=[y,(x0+sqrt(pi))/exp(2)];
end
end
plot(x,y)
结果: