STSplot(yPlot,yOffs​et,repetitionNumber​, varargin)

Automates (waterfall) plotting of STS data from RHK's R9 converted to .mat by sm4reader
88 Downloads
Updated 7 Jul 2017

View License

STSplot.m Plots STS data converted by sm4reader
plottedData = STSPLOT(yPlot,yOffset,repetitionNumber,varargin)
Note: This code requires the varycolor.m program by Daniel Helmick for dynamic colour designation.
This program was developed in the Hollen Lab at UNH. More information on this program and related programs can be found here: http://unh2d.weebly.com/using-sm4-files-in-matlab.html

STSPLOT plots scanning tunneling spectroscopy (STS) data which is either still in the .sm4 format (requiring sm4reader.m) or which has already been converted from .sm4 to the .mat format generated by sm4reader.m or output by this function.

The program also outputs the plotted data to a .mat structure file in case you want to do further operation on your averaged or smoothed data.

IMPORTANT NOTE: These structures cannot currently be fed back into the STSplot program; they are just to be used by hand.

The program is designed to aid in creating waterfall plots (with or without data averaging and/or smoothing), and also displays a flattened topographic image with the locations the STS data were taken marked on the image, with colours coordinated with the STS spectra plots.

The STS files are either a set of point spectroscopy data (with possible multiple repetitions of the measurement per file), or a single file which contains STS measurements at several points along a line on a sample surface (with possible repetitions). The associated topographical file is required to mark the physical locations, but can be turned off with an optional flag.

The function call is:
STSplot(yPlot,yOffset,repetitionNumber,varargin)

yPlot is the types of plots you want to generate. This field is a cell and can be {'dI/dV'} , {'Current (A)'} or both in whichever order you choose, such as {'dI/dV', 'Current (A)'}.

yOffset is used to generate waterfall plots, the offset is used between different point spectroscopy locations, or the series of locations in a line for line spectroscopy. The offsets are given as an array in the same order of the plot types, e.g. [4e-12,1e-10] for two plot types.

repetitionNumber controls which repetitions of each measurement you are plotting. You can enter the following values:
an integer --that repetition is plotted, e.g. 1, 2
'all' --all repetitions per point are plotted simultaneously
'average' --this plots the average of all the repetitions for each measurement location
'allwithaverage' --plots all repetitions, with a curve for the average shown in black (note if the last measurement is in black the average remains black as well)

After reptition number you can include optional arguments. These include:
*Data smoothing
Call by entering {'smooth',<smoothwidth>}, where <smoothwidth> is a natural number which says what number neighbors you will use to average at each point. 0 is no smooth, 1 is nearest neighbors only (3 points), 2 is two neighbors on each side (5 pts), etc..

*Scan direction arrow
On the plotted topography data for line spectroscopy, you can include an arrow that shows what direction the plotting took place. Include 'arrow' as the argument to enable the arrow.

*No spatial image
By including 'nospatial', the user will not be queried for a topographic scan, and will not plot the topographic data.

An example call using some optional fields is:
STSplot({'Current (A)','dI/dV'},[0,0],'average', {'smooth',20},'arrow')

Cite As

Jason Moscatello (2024). STSplot(yPlot,yOffset,repetitionNumber, varargin) (https://www.mathworks.com/matlabcentral/fileexchange/62629-stsplot-yplot-yoffset-repetitionnumber-varargin), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Chemistry in Help Center and MATLAB Answers
Tags Add Tags
Acknowledgements

Inspired by: sm4reader(fileID), sm4tomatlab()

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2.0.0

I had changed the x and y scale to nm (instead of points), which made my arrow stop working. The arrow is now fixed.

1.1.0.0

1. Better flattening. 2. Reference line at V=0. 3. Output the plotted data to the workspace. 4. Option for no spatial plot.

1.0.0.0