interpolation for 4cos(x) − ex = 0

조회 수: 1 (최근 30일)
xbhax
xbhax 2021년 11월 22일
댓글: xbhax 2021년 11월 22일
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