interpolation for 4cos(x) − ex = 0

1 次查看(过去 30 天)
theres only one positive root for the equation 4cos(x) − ex = 0 for [0,1] domain. use a parabolic function calculated through interpolation to find the approximation for this root. you can choose whatever points you want.
any idea on how to solve this? thanks yall in advance!
  4 个评论
James Tursa
James Tursa 2021-11-22
编辑:James Tursa 2021-11-22
Are you supposed to pick any three points you want, fit a parabola to those points, and then find the root of that parabola in the [0,1] domain? Can you use the MATLAB polyfit( ) and roots( ) functions for this? Or are you supposed to be using hand-written code?
xbhax
xbhax 2021-11-22
no, i cant use polyfit nor roots for this... and yes to the 1st question :)

请先登录,再进行评论。

采纳的回答

James Tursa
James Tursa 2021-11-22
编辑:James Tursa 2021-11-22
Without seeing the text of your assignment, I would presume that this is the outline of what you are supposed to do:
1) Define the function y(x) = 4*cos(x) − exp(x)
2) Pick three points of this function near the desired root in interval [0,1], e.g. (0,f(0)), (0.5, f(0.5)), (1,f(1))
3) Fit a parabola to those three points
4) Find the root of that parabola in the [0,1] interval
Steps 1 and 2 are very easy. Step 3 would have been very easy with polyfit( ), but it is still easy to solve for arbitrary parabola coefficients using a hand written algorithm. Just ask yourself if you have three points (x1,y1,), (x2,y2), and (x3,y3), how would you write the equation of a parabola that passed through these three points? That would give you three equations in three unknowns (the parabola coefficients a, b, c). Then step 4 is easy with your own quadratic formula or other quadratic root code.
See if you can figure out step 3 and come back with any problems you might have.
  4 个评论
James Tursa
James Tursa 2021-11-22
编辑:James Tursa 2021-11-22
I was using a, b, and c to denote the coefficients of the quadratic function. This doesn't match what you have for a, b, and c above.
To solve for the roots of a quadratic function, you could simply use the quadratic formula. That will give you the x value approximation of the root to the original function.
xbhax
xbhax 2021-11-22
got it! thanks a lot! :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by