Pitch is defined by its perceptual qualities, and therefore has to be determined by the judgment of human listeners. By convention, we use the pitch evoked by pure tones as a yardstick with respect to which we judge the pitch evoked by other sounds. In practical terms, this is performed by matching experiments: A periodic sound whose pitch we want to measure is presented alternatively with a pure tone. Listeners are asked to change the frequency of the pure tone until it evokes the same pitch as the periodic sound. The frequency of he matching pure tone then serves as a quantitative measure of the pitch of the tested periodic sound. In such experiments, subjects most often set the pure tone so that its period is equal to the period of the test sound. In the demonstrations below, the sound to be tested is played four times alternately with a pure tone. The test sound is the same at all repetitions, but the period of the pure tone changes from repetition to repetition: it is the same as the period ot the test sound in the first repetition, shorter(higher pitch) in the second, longer (lower pitch) in the third, and is again the same as that of the test sound in the last repetition.
Here is the demonstration, with the test sound being a cosine-phase harmonic complex at 400 Hz:
Here is the demonstration, with the test sound being an Iterated Repeated Noise (IRN) with 4 iterations, again at 400 Hz:
Now you are ready to try pitch matching by yourself. In the following gadget, you can select the type of pitch-evoking sound and try to match it by moving the slider: