Question
The AFM image scan size is 20 by 20 m and contains 512 x 512 data points. The height information is displayed by the color
The AFM image scan size is 20 by 20 m and contains 512 x 512 data points. The height information is displayed by the color contrast. The actual height data is contained in an excel file called PTFE Surface Topography Data - AFM.xls. This file contains the Z-height of a surface at an equally spaced distance in the X and Y direction. Each row represents the scan length of 20 m in the X direction and there are 512 data points. Similarly, each column represents the scan length of 20 m in the Y direction and there are 512 data points.
Using the above information what does the following Matlab code need to change to function?
% Read in the excel file containing the surface topography data
data = readmatrix('PTFE Surface Topography Data - AFM.xlsx');
% Extract the x and y coordinates and z values from the data
x = data(:,1);
y = data(:,2);
z = data(:,3);
% Plot a 2D image of the measured surface
figure(1)
imagesc(x, y, z)
colorbar
xlabel('x')
ylabel('y')
title('2D Image of Measured Surface')
% Plot a 3D image of the surface
figure(2)
surf(x, y, z)
colorbar
xlabel('x')
ylabel('y')
zlabel('z')
title('3D Image of Measured Surface')
% Calculate surface topography parameters
mean_z = mean(z);
z_range = range(z);
Ra = sum(abs(z-mean(z)))/length(z);
Rq = sqrt(sum((z-mean(z)).^2)/length(z));
skewness_z = skewness(z);
kurtosis_z = kurtosis(z);
Rp = max(z);
Rv = min(z);
% Calculate Bearing Area Ratio (BAR)
threshold = Rv + 200e-9;
binary_z = z > threshold;
total_area = length(z)*(x(2)-x(1))*(y(2)-y(1));
masked_area = sum(binary_z(:))*(x(2)-x(1))*(y(2)-y(1));
BAR = masked_area/total_area;
% Show a 2D image of the masked surface
figure(3)
imshow(binary_z)
title('Binarized Image of the Masked Surface')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started