Hello. I am trying to graph the different approximations of the function $f(x)=|x|$ by convolutions with the standard Mollifier function. However, my code doesn't output the correct graph. What is wrong in the code? (This question is motivated by a topic I made Application of Mollifier function.)
Actualization 1: I tried the following code in Scilab but it doesn't work. error appears. Attached image.
x = -1:0.1:1;
f = (x > -1 & x < 1).*abs(x)+(x <= -1 | x >= 1).*0;
phi = (x > -1 & x < 1).*(exp(1/(x.^2-1))/sqrt(2*%pi))+(x <= -1 | x >= 1).*0;
y = conv(f, phi, 'same') * 0.1;
plot(x, f, 'b', x, y, 'r');
legend('f(x)', 'Convolution f * phi');

