Explore BrainMass

Matlab Hermite Interpolation

(See attached file for full problem description with equations)

I need some guidance on a Matlab programming project. The project concerns Hermite polynomial interpolation. We are given values and and their derivatives and at and respectively, and we look for coefficients such that if



I found that the following coefficients satisfy the above requirements:

with .

Next I am to write a Matlab function which takes inputs x,y0,dy0,y1,dy1 and returns the value of the cubic polynomial q at x that satisfies the above conditions. I have written the function and it is pasted below:

function y=qHermite(x,y0,dy0,y1,dy1)
%%qHERMITE returns the value of the cubic polynomial q
%%at x which satisfies q(0)=y0,q'(0)=dy0,q(1)=y1,q'(1)=dy1

y = y0+dy0*x+(y1-y0-dy0)*x.^2+(dy1+dy0-2*(y1-y0))*x.^2*(x-1);

Next I am to find the corresponding formula for when are replaced by . This polynomial will be called . After some algebra work, I found and its coefficients to be


, , , .

Now finally comes the part with which I need assistance. I am to write a Matlab function for which uses the function I wrote for . I can write a program for Q which stands alone, but I do not see any way to write a function for Q which calls q, since the coefficients are different in each case. Please show me how this can be done.
Thanks in advance!