Calculate the Root Mean Square Slope of a surface elevation matrix.
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a surface elevation matrix with 1987 x 2353 points from a laser scanner. The spacing in the x and y direction is 0.0497 and 0.0415 respectively. I need to calculate the root mean surface slope(Sdq) of the surface which should be calculated from the following equation. I am an newbie in MATLAB and nee your help. A sample of the data matrix is attached here since the comlete file is so big I hope this data part will be okay. If you can write a short code to calculate the room mean slope given the formula I would appreciate. Thanks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428368/image.png)
0 Commenti
Risposta accettata
Ashutosh
il 10 Lug 2023
Hello, I will assume that by A you mean the lateral area of the surface you are studying. Hopefully you are aware of general coding structures like a 'for' loop. If not, first please refer to this.
For convention, assume rows as the 'y' dimension and columns as the 'x' dimension. For integrals in MATLAB, you can calculate the value of the integrand for each individual element, and then sum them up using a for loop as below:
t = readtable("<ProvidePathToDataHereWithinQuotes>", "ReadRowNames",false,"ReadVariableNames",false);
t = table2array(t); % reading the xlsx file and converting to a matrix
dx = 0.0497;
dy = 0.0415;
sum = 0;
for i=1:109 % iterate through y dimension
for j=1:99 % iterate through x dimension
dzy = (t(i+1,j)-t(i,j))/dy; % dz/dy
dzx = (t(i,j+1)-t(i,j))/dx; % dz/dx
s = (dzy^2 + dzx^2) * dx * dy; % squaring dz/dy, dz/dx and multiplying with dx, dy
sum = sum + s;
end
end
Y = size(t,1)*dy;
X = size(t,2)*dx;
A = X*Y;
rms_slope = sqrt(sum/A);
Hope this helps. In case something is not clear, let me know so you can get used to MATLAB faster.
2 Commenti
Florin
il 24 Ago 2023
Check here below for the standard way to calculate dzy and dzx in the code provided above:
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!