I have a program that loops ITERATIONS times.
I need to set a variable X that grows proportionally to the number of iterations.
The proportion is:
everytime the variable ITERATIONS is equal to 2^n then set X = n
Example:ITERATIONS = 2 X = 1ITERATIONS = 2^2 = 4 X = 2ITERATIONS = 2^3 = 8 X = 3ITERATIONS = 2^4 = 16 X = 4
How do I do this in matlab?
I was thinking something like:
If (ITERATIONS = 2^n) X= n
Am I on the right path?
Best Answer