XRDMLread - Matlab function for reading X'Pert XRDML files

XRDMLread Add-ons

Contents


Peak Fitting Functions

In addition to the XRDMLread.m itself this project proposes peak fitting functions suitable especially for analysis of powder XRD data. These functions are indeed necessary for running the Example no. 3.

Three type of profiles are included.

  1. pseudo-Voigt profile
  2. asymmetric pseudo-Voigt profile
  3. asymmetric PearsonVII profile

The basic enhancements of the functions here consist in the following points.

  1. Multiple x-ray spectral lines (K-no.α doublet) can be included very easily.
  2. The functions are designed to
    • fit multiple overlapping reflections simultaneously,
    • enable a simple control of refined parameters.

You can set multiple spectral lines by defining a global variable WAVELENGTHS. See help pseudoVoigt for detailed information or a sample code from Example no. 3 below.

% X-ray diffraction: global WAVELENGTHS
% 
% Function support a global variable WAVELENGTHS that
% represent an array of size (m x 2), where m is a number
% of spectral lines. The WAVELENGTHS matrix has this
% interpretation:
%
% the 1st column - relative line intensity
% the 2st column - delta(Lambda)/Lambda ratio
%                  (Lambda is an average wavelength)
%
% example: CuKalpha1 + CuKalpha2 (Lambda = 1.5419)

d = XRDMLread('TiO2_STRESS.xrdml'); % with 'K-Alpha' radiation

global  WAVELENGTHS

WAVELENGTHS = [           1.0    (d.kAlpha1-d.Lambda)/d.Lambda ; ...
                d.kAlphaRatio    (d.kAlpha2-d.Lambda)/d.Lambda ];

The functions are designed to easily fit multiple overlapping reflections simultaneously. Peaks parameters are stored in matrices. Each row represents a single peak. Refinement flags (logical indices Linda) for individual parameters have the same structure. See e.g. help pseudoVoigt, help pseudoVoigtFit for more detailed information or a sample code from Example no. 3 below. Three diffraction lines are defined there. Because (103) and (112) lines are weak, their shape parameter (eta) is not refined. It's kept constant during fitting.

% a0 = [ Intensity  2Theta  HWHM  eta ]

% add diffraction lines (anatase - database)
a0(1,:) = [56 36.95 0.2 0.5]; % (103)
a0(2,:) = [88 37.79 0.2 0.5]; % (004)
a0(3,:) = [36 38.57 0.2 0.5]; % (112)

% set refined lines parameters
Linda(1,:) = [1 1 1 0]; % (103)
Linda(2,:) = [1 1 1 1]; % (004)
Linda(3,:) = [1 1 1 0]; % (112)

% fit data
[a,b,da,db] = pseudoVoigtFit(x,y,w,a0,b0,[],Linda);

List of All Peak Fitting Functions

Each set of functions has three files.

Original routines for the pseudo-Voigt.

Additional routines for the pseudo-Voigt — version with Asymmetric function, added 08 Jun 2007.

Additional routines for the Pearson VII — version with Asymmetric function, added 31 Mar 2008.


linfit.m

A routine for straight line fitting of data with uncertainties in y-values. A simple implementation according to the Numerical Recipes. Used in the Example no. 3 for fitting Sin2(Psi) plots.