X = -2:2; Y = [1 0 1 0 1]; P = lagrangepoly(X,Y); xx = -2.5:.01:2.5; plot(xx,polyval(P,xx),X,Y,'or'); grid;