A virtual NC − AFM machine has been built using the Matlab language. The virtual NC − AFM is identical to a real hybrid machine built with Digital Instruments and Omicron blocks. Therole of every subset is described in detail, and special attention is paid to the parameters of theAutomatic Gain Control (AGC) which controls the amplitude of the oscillations. The virtual machine isa powerful tool, that allows to solve, without any approximation, non linear coupled differentialequations describing the physics of the tip-surface interaction. The machine is then used to study thefrequency shift and damping signal in the approach-retract mode. Two types of situations are analyzed: thefirst one corresponds to the case where no dissipative force is introduced in the tip-surface interaction,the second one deals with dissipative forces. These last ones are here introduced by assuming a mechanicaldeformation of the surface under the tip. Interesting results are then obtained, in particular the factthat unstability may occur under some particular conditions. Most of the results obtained by simulationare then compared with those of analytical models already published in the literature.