I am new to Matlab, help please. In the book I saw this picture for the following polynomial: $g(t)=x_1+x_2t+x_3t^2+ \ldots +x_{10}t^9$ for some $t$ and $g(t)$.
The following code is given:
t=transpose(linspace(-1,1,50)) y=1./(1+25*t.^2) n=10 A=fliplr(vander(t)) A=A(:,1:n) x=A\y u=linspace(-1,1,1000) g=x(n)*ones(1,1000) for i=(n-1):-1:1 g=g.*u+x(i) end plot(u,g,'-',t,y,'o')
I am trying this code in Matlab but not getting the same picture. I think I need to input some code at first, before the above written code, that somehow tells to Matlab the code is for polynomial of degree 9. I do not see how this code tells about polynomial degree to Matlab.
What do I need to do to get the same picture?