I’m trying to plot the following piecewise function in MATLAB:
x=linspace(0,1,100);
e=1;
n=9;
N(e,:) = (n*x-e+1).*(x>(e-1)/n).*(x<e/n) + (-n*x+e+1).*(x>e/n).*(x<(e+1)/n);
plot(x,N(e,:));
And the result is this:

instead of an isosceles triangle as it should be. Does anybody know how to fix this or have any alternative?
I assume you want your function to actually have value of 1 at
x=0.11instead of value of 0. For this, you can simply replace(x<e/n)with(x<=e/n).