Help to solv a equation with iteration
Show older comments
I need help, how do i make a code in matlab for iterate the following eq:
x=0.46-0.5*cos(3.14*(y/d))+0.004*cos(2*3.14*(y/d))
where y is the only unknown constant? i know the value of x and d.
1 Comment
Azzi Abdelmalek
on 8 Mar 2013
What do you mean?
Accepted Answer
More Answers (1)
Roger Stafford
on 9 Mar 2013
Edited: Roger Stafford
on 9 Mar 2013
You can solve that equation without doing any iteration, Claus. Using the formula
cos(2*A) = 2*cos(A)^2-1
your equation is equivalent to
.008*cos(3.14*y/d)^2-.5*cos(3.14*y/d)+.456-x = 0
and this is a quadratic equation in cos(3.14*y/d) which you can solve for. You will then have the unknown y expressed as d/3.14 times the arccosine of the two possible roots of this quadratic. (I presume 3.14 is your approximation for pi.) Provided either of these roots lie between -1 and +1, this will give you an infinite number of possible real-valued solutions for y.
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!