# “Perfect” 1D pattern generation software.

I have written some small, simple bits of Matlab software that can generate scattering patterns in the range you request for polydisperse, dilute spheres or ellipsoids. While nothing new per se, this implementation is guaranteed to produce correct scattering patterns irrespective of the width of the distribution. Allow me to quickly explain.

The normal way of calculating these patterns in fitting functions and the likes, is to choose an upper size limit (perhaps related to the width and mean of the distribution), and divide the size range between zero and this upper limit into perhaps 100 different sizes. Then the scattering pattern of each of these contributions is calculated, multiplied with their probability (obtained from the probability (or size) distribution function), multiplied with the square of the particle volume for that size, and then summed. In all, then, this is a numeric integration over the volume-square weighted size distribution.

The problem lies in the determination of the upper limit and the number of divisions required. In the past, I have tried using the cumulative distribution function to select “smart” divisions, or adjusting the width and mean to compensate for the volume-square weighting, but this often resulted in the appearance of oscillatory behaviour in the scattering patterns. An alternative solution was therefore required.

These functions are not necessarily fast enough for fitting purposes, but they can be used for checking the applicability of your fitting procedures. You should get out of your fitting functions what you put into these simulated patterns.

These functions work by random generation of a number of spheres or ellipsoids. A scattering pattern is calculated from an initial number of spheres or ellipsoids. Then, the scattering pattern is calculated of the original block with the addition of a new set of shapes. This is repeated until the effect of adding a new block on the scattering pattern no longer exceeds a certain threshold.

Included are the programs for generating scattering patterns using polydisperse distributions of spheres or ellipsoids. All distributions supported by the “statistics library”‘s RANDOM function are available. For ellipsoids, an additional distribution can be used for the aspect ratio. If the use is not clear, let me know and I will write some more extensive documentation.

The programs are: perfectpattern_spheres and perfectpattern_ellipsoids. Have fun!

#### Be the first to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.