Clear Filters
Clear Filters

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

5 views (last 30 days)
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)
  2 Comments
John D'Errico
John D'Errico on 18 Jun 2018
So, two points, with two pieces of information at each, will allow you to estimate 4 coefficients. So a cubic polynomial. What have you tried? If nothing, on what is very likely homework, why nothing? Why not try something? Then show what you try, and you might get some help. Otherwise, I would suggest using solve as a possibility. Or, you could do it using many other approaches, including pencil and paper.
John D'Errico
John D'Errico on 18 Jun 2018
Come on. What would you try?
I'll get you started.
x1 = 3.4;
x2 = 3.6;
syms x a b c d
P(x) = a*x^3 + b*x^2 + c*x + d;
F(x) = cos(2*x^2);
dF = diff(f);
dP = diff(P);
Now, you need to make some effort. What equations would you write? How would you solve them?

Sign in to comment.

Accepted Answer

KSSV
KSSV on 18 Jun 2018
f = @(x) cos(2*x.^2) ;
N = 100 ;
x = linspace(3.4,3.6,N) ;
y = f(x) ;
plot(x,y) ;

More Answers (0)

Categories

Find more on Polynomials in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!