NOVELTY - The scanning method involves generating data signal using a sensor. The first component based on a motion in a first direction of an actuator configured to provide motion between a sample and a probe in the first direction, the first direction substantially in the plane of sample (102). The second component based on topographic variations of the sample in a second direction, and a materials property of the sample. The processor is used to generate the compensatory signal based on the first component of the data signal generated by the sensor and providing compensatory signal to the actuator. USE - Method for scanning sample. ADVANTAGE - Allows high speed and high precision scanning with a scanning probe microscope while removing artifacts of scanner dynamics e.g. scanner resonances that would otherwise be present in the resulting images. Provides clearer images so that the topographical details of the scanned sample are readily resolved. The ability to perform high speed imaging enables the study of non-stationary or time-dependent samples such as live biological specimens. The real-time strategy of scanner characterization allows aggressive model-inversion filters to be designed that do not need to accommodate the wide variability of possible dynamics traditionally associated with robust control. The resonance compensation module is applied as a simple and inexpensive retrofit to existing scanning probe microscopes, while the resonance compensation module is versatile and can be used with various brands and models of scanning probe microscopes.