Forum Discussion
Altera_Forum
Honored Contributor
9 years agoThis is a late response but to help anyone else looking to do this. The above post will technically work. However, it may be very slow at getting the correct response and you are limited on how you constrain certain variables.
To combat this, I have used a Genetic Algorithm to calculate these values. The genetic optimization algorithm is used because it is able to handle both integer values and decimal values where as other algorithms can only handle decimal values. I run the algorithm in matlab because it is unbelievably easy and that is all I need at the moment, but I'm assuming that you can find a c or c++ implementation rather easily. You can do this by minimizing the error of the output frequency calculated from the equation from the actual output frequency you want. The equation for doing this looks like this below: objF = ((Fin*(M+Mdec)/(N*C))-Fout)^2. With your decision variables being M, Mdec, N, and C. From there, you can enter in constraints etc. Just google matlab genetic algorithm for documentation on how to use these algorithms.