image thumbnail

Surface generator: artificial randomly rough surfaces

version 1.1.0.0 (7.27 KB) by Mona Mahboob Kanafi
Generates randomly rough fractal surfaces with different fractal (Hurst) parameters

2.3K Downloads

Updated 19 Dec 2016

View License

This code generates artificial randomly rough isotropic surfaces. These surfaces could be useful for simulating surface roughness or topographies from nanometre features of engineering surfaces to large-scale topography of mountains, terrains or landscapes. The code is based on simulating the surface topography/roughness by means of fractals. It uses the Fourier concept (specifically the power spectral density) for surface generation.
There are two options for surface generation, either the generated surface has a roll-off region or without a roll-off region. If you are not familiar with the concept of roll-off, refer to the uploaded image for this code.
For the code you need 5 inputs (with no roll-off region), or then 6 inputs (including roll-off wavevector). These inputs are:

1- root-mean-square roughness (Rq), i.e. standard deviation of surface heights (sigma σ)
2- Hurst exponent (H), which is related to the fractal dimension of a surface topography D=3-H. For example, a Brownian surface roughness has H= 0.5. The parameter H can take values between 0 and 1.
3- Lx, which is the length of final topography/image in x direction (it could take any values from nanometre to hundreds of metres)
4- m, which is number of pixels in the x direction of final topography/image
5- n, which is number of pixels in the y direction of final topography/image
6- (OPTIONAL INPUT) qr, which is the roll-off wavevector (check uploaded image for its meaning)

Two examples of generated surfaces:

[z , PixelWidth, PSD] = artificial_surf(1e-2, 0.8, 0.1, 512 , 512);
Generates a surface named z with standard deviation of 1 cm, hurst exponent of 0.8 (i.e. fractal dimension of 2.2), length of final image is 10 cm. It generates a square image with 512 data points in x and y direction. The final resolution (i.e Pixel Width) equals Lx/m = 195.3 micron.

[z , PixelWidth, PSD] = artificial_surf(1e-3, 0.8, 0.1, 1024, 512,1000);
Generates a surface named z with standard deviation of 1mm, Hurst exponent of 0.8 (i.e. fractal dimension of 2.2), length of final image is 10 cm. It generates a rectangular image with 1024 data points in x direction and 512 data points in y direction. The surface has a roll-off region at qr = 1000 (1/m), which equals to a wavelength lambda_r = (2*pi)/qr = 6.3 mm. The final resolution (i.e Pixel Width) equals Lx/m = 97.7 micron.

tips:
- By increasing m and n (don’t go higher than 2048 on a normal computer) or reducing Lx, you can generate surfaces with higher resolution.

- The surface is generated by its surface roughness power spectrum. This data is stored in the structure named PSD. If interested, for instance, you can check the analysis by comparing this PSD with the results you get by applying power spectral method on generated surface:

Radially Averaged Surface Roughness Power Spectrum (PSD)
http://se.mathworks.com/matlabcentral/fileexchange/54297-radially-averaged-surface-roughness-power-spectrum--psd-

Please let me know, if you have any problems or there is a bug!

Cite As

Mona Mahboob Kanafi (2022). Surface generator: artificial randomly rough surfaces (https://www.mathworks.com/matlabcentral/fileexchange/60817-surface-generator-artificial-randomly-rough-surfaces), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
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!