MATLAB: How to find polynomial fiting on f(x) with known f(x1),f(x2​),f'(x1),f​'(x2)

polynomial

According to theory if two values for f on X1,X2 and the derivatives on X1,X2 you can use them to find a polynomial p(x) with p(x1)=f(x1), p(x2)=f(x2), p'(x1)=f'(x1), p'(x2)=f'(x2). I want to do that for f(x)=cos(2x^2) at 3.4=<x<=3.6 I have found the values for p and p' but i dont know how to combine them to get the polynomial (poly command is only useful for roots)

Best Answer

f = @(x) cos(2*x.^2) ;
N = 100 ;
x = linspace(3.4,3.6,N) ;
y = f(x) ;
plot(x,y) ;
Related Question