%This auxiliary program is used to provide a data set to % the Hermite subroutine, obtain the interpolating % polynomial, evaluate it a point "p", and make a graph of this % Hermite polynomial between the end points of the data set. clear; % Input Data. x=[1.3,1.6,1.9]; y=[0.6200860,0.4554022,0.2818186]; yp=[-0.5220232,-0.5698959,-0.5811571]; p=1.5; N=3; disp('Input Data'); disp([x',y',yp']); % Call to Hermite subroutine to obtain % the value of the interpolating polynomial at point "p". [HP,Q]=SHerm(p,N,x,y,yp) % Polynomial obtained by the Hermite subroutine fprintf('Interpolating Polynomial obtained by the Hermite subroutine in the interval:(%4.2f,%4.2f)\n\n ',... x(1),x(N)); fprintf('HP(x)=%7.4f + %7.4f(x-%4.2f))+ %7.4f(x-%4.2f)^2)+.... +%7.4f(x-%4.2f)^2...(x-%4.2f) \n\n'... , Q(1,1),Q(2,2),x(1),Q(3,3),x(1),Q(2*N,2*N),x(1),x(N)); % Graph of the polynomial obtained by evaluating it at 500 points between x(1) and x(N). step=(x(N)-x(1))/500; pp(1)=x(1); PV(1)=Q(1,1); for i=2:501 pp(i)=pp(i-1)+step; [PV(i),Q]=SHerm(pp(i),N,x,y,yp); end plot(pp,PV); hold on; plot(x,y,'*');