Magnetic dipole fit to Gwyddion TTF of a MFM probe.

Approximate the stray field gradient of a MFM probe using a magnetic dipole and simulated annealing to find the best parameters.
37 Downloads
Updated 15 Apr 2020

View License

This script is used to obtain the dipole approximation of a magnetic force microscope (MFM) probe. See as an example the supplementary material of [1] and [2].

NOTE: For this script to work, you need to have in the same folder the simulated annealing function. It can be found in [3].
NOTE: Simulated annealing is slow, typically the fitting takes about 5 min.

Outside of the script: Gwyddion is used to calculate the magnetic field gradient of the MFM probe, as shown in [2]. The TTF image is exported as a txt file including a header (an example of data is included as both a txt and a png files).
Then, in the script:
1) Takes the text file and extract the raw data and the size of the image from the header
2) Calculates the magnetic field generated by a dipole (in symbolic form).
3) Calculates the derivative of the z-component of the field along the z direction.
4) It is assumed that the dipole approximation is centred at x=0 and y=0. At the moment the script doesn't considers a dipole shifted from the origin in x and y. The magnetic moment is decomposed in mmx mmy and mmz, and is located at a height, called rrz, from the tip of the probe.
5) Simulated annealing script[3] is used to find the values of mmx mmy mmz and
rrz that minimize the least square error between the given data and the
dipole approximation.

References:
[1] Casiraghi, A., Corte-León, H., Vafaee, M. et al. Individual skyrmion manipulation by local magnetic field gradients. Commun Phys 2, 145 (2019). https://doi.org/10.1038/s42005-019-0242-5

[2] Corte-León, H., Volker, Neu, Manzin, Alessandra et al. Magnetic Force Microscopy: Comparison and Validation of Different Magnetic Force Microscopy Calibration Schemes. Small 11, (2020). https://doi.org/10.1002/smll.202070058

[3] Hector Corte, Simulated Annealing Optimization, Taken on the 12th of April 2020. https://uk.mathworks.com/matlabcentral/fileexchange/33109-simulated-annealing-optimization?s_tid=prof_contriblnk&s_tid=mwa_osa_a

This script was written by :
Dr. Héctor Corte-León
Higher Research Scientist
Quantum Materials and Sensors
National Physical Laboratory
Hampton Road
Teddington
TW11 0LW
Phone: (+44) 0208 943 6739
Email: hector.corte@npl.co.uk

Cite As

Héctor Corte (2024). Magnetic dipole fit to Gwyddion TTF of a MFM probe. (https://www.mathworks.com/matlabcentral/fileexchange/75005-magnetic-dipole-fit-to-gwyddion-ttf-of-a-mfm-probe), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
3.0.0

Now data is directly inputted as the TTF image from Gwyddion (exported as txt file). Fitting is done on m_x m_y m_z and height of the dipole. Output includes cross section along x, y and the 3D plot of raw and fitted data.

1.0.0