# How is energy quantized? [duplicate]

I'm at the moment studying quantum physics and I came across $$E=hf.$$ My question is: how come there are only certain energies allowed if in this formula $f$ can be any number, and therefore, energy could be any number? Are there only certain values of $f$ allowed? What am I not understanding correctly?

• Think only about confined systems, such as an atom, where there is a potential well "pulling" the electrons in. Now we measure the energies, and we find that only certain values are found. This equation does not apply to free electrons, moving without any restriction, they can have any energy. – user178231 Dec 18 '17 at 9:56