Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Function: Linear Regression using Matrices
Function
A function to carry out linear regression of a 1D plot using matrices.
Version
version:20220617, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments

This linear regression function uses matrices to carry out linear regression. The passed in image should be a 1D spectrum or profile. The function returns the best straight line fit as a plot. It also returns the slope and intercept and the R squared good of fit value.

The other linear regression function on this website, uses serial processing of data. This makes it slow for large data sets. In contrast, this function carries out matrix operations (parallel processing of data), and so is much faster when handling large datasets.

System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
-
Supported
Yes
Included Files
Main script file.
Source Code

See the attached script file.