function w = hermite(n,v) m=length(v); x = linspace(0,pi,n+1); h = pi/n; w = zeros(1,m); for j=1:m t = v(j); i=1; while t>x(i) i = i + 1; end if i > 1 i = i-1; end s=t-x(i); y_i = cos(x(i)); %Cambiar esto segun la funcion que se quiera interpolar y_i_1 = cos(x(i+1)); d_i = -sin(x(i)); d_i_1 = -sin(x(i+1)); w(j) = (3*h*s^2 - 2*s^3)*(1/h^3)*y_i_1 + (h^3 - 3*h*s^2 +... 2*s^3)*(1/h^3)*y_i + s^2*(s-h)*(1/h^2)*d_i_1+s*(s-h)^2*(1/h^2)*d_i; end end