How to write the MATLAB code for AFM data?
9 次查看(过去 30 天)
显示 更早的评论
I am a research scholar and have a paper that analyse the AFM data. I have the AFM data in ASCII xyz format. I have to calculate the parameters given in the journal paper. I have attached herewith the paper and the data file.
Please help.
I shall be grateful to you.
0 个评论
回答(1 个)
Star Strider
2019-7-22
编辑:Star Strider
2024-1-24
I will defer to you to do the analysis, however getting the data as matrices is not obvious. I can help with that.
Your data are gridded so use reshape to create matrices from them:
A = dlmread('Figure 3(a).txt', '\t', 4, 0);
rs = mean(diff(find(A(:,1) == 0)));
X = reshape(A, rs, rs, []);
figure
meshc(X(:,:,1), X(:,:,2), X(:,:,3))
xlabel('X (Å)')
ylabel('Y (Å)')
zlabel('Z (nm)')
I leave the rest to you.
EDIT — (24 Jan 2024 at 14:21)
Using the ability to run this here that was not available when this originally posted (and adding a few tweaks) —
T1 = readtable('Figure 3(a).txt', 'VariableNamingRule','preserve', 'Delimiter',{' ','\t'}, 'MultipleDelimsAsOne',true, 'HeaderLines',2, 'EmptyLineRule','skip')
VN = T1.Properties.VariableNames;
A = table2array(T1);
rs = mean(diff(find(A(:,1) == 0)));
X = reshape(A, rs, rs, []);
SizeX = size(X)
figure(3)
hmc = meshc(X(:,:,1), X(:,:,2), X(:,:,3));
hmc(1).EdgeColor = 'interp';
hmc(1).FaceColor = 'interp';
colormap(turbo)
xlabel(VN{1})
ylabel(VN{2})
zlabel(VN{3})
title('Figure 3(a)')
The code uses reshape to transform ‘A’ (65536 x 3) to ‘X’ (256 x 256 x 3) and then plots it as a surf plot.
.
2 个评论
Somsubhra Saha
2020-4-12
sorry, I cant understand. Can you please tell me in detail as I am new in this field.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

