How to find polynomial fiting on f(x) with known f(x1),f(x2),f'(x1),f'(x2)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Iakovos Antonoglou
el 18 de Jun. de 2018
Comentada: John D'Errico
el 18 de Jun. de 2018
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 comentarios
John D'Errico
el 18 de Jun. de 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
el 18 de Jun. de 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?
Respuesta aceptada
KSSV
el 18 de Jun. de 2018
f = @(x) cos(2*x.^2) ;
N = 100 ;
x = linspace(3.4,3.6,N) ;
y = f(x) ;
plot(x,y) ;
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Polynomials en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!