circuit 10 the first and second input terminals of a second lock in amplifier 8 are respectively connected to the output terminal of the tunneling current detector circuit 11 and that of the oscillator 3 while its output terminal is connected to the input terminal of the arithmetic circuit 12 a barrier height measuring apparatus having a configuration as described above operates in the following manner to obtain data on the profile of the specimen electric signals having a basic frequency of u03c9 c are applied to the piezoelectric actuator 2 by the oscillator 3 to vertically oscillate the free end of the cantilever 1 in the z direction with an amplitude of about 0 1 nm the displacement hereinafter expressed by z tip of the front end of the cantilever 1 is sensed by the optical displacement sensor 4 for each instant of scanning and a signal representing the displacement for that instant is sent to the first lock in amplifier 5 the output signal of the oscillator 3 is also given to the lock in amplifier 5 as a reference signal consequently the frequency of the displacement signal z tip is locked to the frequency u03c9 c and detected in the lock in amplifier 5 which by turn sends out the amplitude hereinafter expressed by u03b4z tip of the oscillation of the cantilever 1 on the other hand as the specimen 9 is moved in the z direction to get closer to the probe of the cantilever 1.