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

조회 수: 1 (최근 30일)
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
John D'Errico
John D'Errico 2018년 6월 18일
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 2018년 6월 18일
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?

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2018년 6월 18일
f = @(x) cos(2*x.^2) ;
N = 100 ;
x = linspace(3.4,3.6,N) ;
y = f(x) ;
plot(x,y) ;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by