I'm programming these SI570 oscillator chips. My question is on using Newton Raphson Iteration to solve the following equation NOT on how to program the SI570. To understand this equation a small summery on the equation is probably useful so....
Here is the equation along with the inequality I have to satisfy
I can choose what f_out_new can be but HSDIV_new and N1_new can only be specific values.
The trick is finding the optimal pair (being a HSDIV value and a N1 value) that will satisfy the inequality the most. By "most", I mean the answer (being f_DCO_new) must be as close as possible or equal to 4.85GHz.
I have searched for typical solutions in using the Newton Raphson Iteration but have fell short of finding an intuitive implementation of solving for two unknowns in an inequality. The only specific answer I did find is here. However, it doesn't use the Newton Raphson Iteration method. I wanted to use the NRI method because I wanted to learn it.
I have implemented the following version with help from various research articles. However, the current version below just solves a quadratic. I'm totally lost here on how to tweak it for my purpose. Any ideas?
1 #include <iostream>
2 #include <cmath>
3 #include <iomanip>
4
5 /**
6 * x^2 + 2x - 15
7 * x_n - ( --------------- )
8 * 2x + 2
9 *
10 * x = -5 , x = 3
11 */
12 double newton_raphson(double x) {
13 return(x - ( ( pow(x, 2) + (2 * x) - 15 ) / ( (2 * x) + 2) ));
14 }
15
16 int main() {
17
18 double x = 0;
19 double x1 = 0;
20 double accuracy = 0.001;
21 std::cout.precision(6);
22 std::cout.setf(std::ios::fixed);
23
24 do{
25 x = x1;
26 x1 = newton_raphson(x);
27 std::cout << x << " " << x1 << " " << abs(x1 - x) << std::endl;
28 }while( abs(x1 - x) >= accuracy );
29
30 std::cout << "The root of the equation is x1 = " << x1 << std::endl;
31 return 0;
32 }
Aucun commentaire:
Enregistrer un commentaire