MATLAB: Help vectors size doesn’t match…why

lagrangeMATLABvector size;

This is my code to evaluate Lagrange where x_in are the given interpolation points and x_out is suppose to be f(x_in), but it keeps saying x_in and x_out don;t have the same vector length
x = -1:50;
y = 1.0 ./ (1+9*x.^2);
x_in=linspace(-1,1,100);
x_out=(1.0) ./ (1+9*(x_in).^2);
y_out=make_Ln(x,x_in,x_out);
plot(x,y,':',x_in,y_out,'*');
title('Lagrange Interpolation:x_in=linspace(-1,1,100)')
legend('y','Interpolation');
figure;

Best Answer

Hi,
x_in and x_out have the same length (100).
x and y are shorter (52), but I don't know if this bothers your function make_Ln().
I suppose y_out and x_in do not match, but without knowing your function make_Ln() I cannot say more.
To plot x_in and x_out is no problem
plot(x,y,':',x_in,x_out,'*')