MATLAB: Do not understand why the code isn’t working!

2dplotnotworking

it should be simple, but nothing show in the figure and nothing is reported by the debugger.
x1=linspace(0,0.1,0.49);
x2=linspace(0.51,0.1,1);
y1=1./(2*x1-1);
y2=1./(2*x2-1);
plot(x1,y1), plot(x2,y2), grid

Best Answer

The third argument in 'linspace' is interpreted as the number of desired points, so you will get at most one point in each one. It is not the same as the colon operator. See
http://www.mathworks.com/help/matlab/ref/linspace.html