Ideally, perform this exercise on a machine, one leg at a time. While machine makes and models differ, most are similar in structure to the one shown below. Higher-quality machines usually allow you to adjust the seat and leg roller. Set the equipment so you situate your knee on the axis of the machine, with your ankle just below the leg roller.
Complete all repetitions of the set with the first leg before beginning repetitions for the second leg.
If you do not have access to a machine, try this exercise on a high stool from a kitchen or bar. With an ankle weight or bag hanging from your foot, place your buttocks near the back edge of the stool. Maintaining your balance carefully, raise your foot in the same motion as demonstrated above. Pay careful attention to keeping your back straight and still.
Do not lock the knee.