How to plot XRD data as 3D plot?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sam
am 7 Sep. 2021
Kommentiert: Star Strider
am 11 Jan. 2022
I have a series of XRD diffractograms from a single sample, at different depths. I want to plot the spectra as a 3D line plot, as seen as below:
(From https://link.springer.com/article/10.1016%2FS1672-6529%2806%2960003-6)
I use the following code to view my XRD data in Matlab:
data = importdata('example_data.dat') ; % load the data from text file
semilogy(data(:,1),data(:,2)) ; % plot the data
How do I go from here?
TIA
0 Kommentare
Akzeptierte Antwort
Star Strider
am 7 Sep. 2021
Bearbeitet: Star Strider
am 7 Sep. 2021
When I click on the link, I get a ‘DOI Not Found’ error. (EDIT — The new link is to an article behind a paywall, so I do not have access to it.)
That problem aside, if the data are in a matrix, it is likely possible just use surf to plot the matrix. The axis tick labels might need to be added manually in separate statements, however this is not difficult.
If you want to upload / attach the .XRD file, it would be necessary to put it into a .zip file first. Any information you have on its contents and format would be helpful, since I dioubt many here are familiar with that format (I am not, since .dat files can contain anything).
The complete matrix, with the values imported and plotted —
Uz = unzip('Plot3D[1].zip')
x = readmatrix(Uz{1}, 'Range','A:A')
ymtx = NaN(numel(x),numel(Uz));
for k = 1:numel(Uz)
ymtx(:,k) = readmatrix(Uz{k}, 'Range','B:B');
end
ymtx
figure
surf(ymtx, 'EdgeColor','none')
grid on
xticklabels = string(x);
yt = yticks;
NrYticks = 9; % Choose Any Integer Divisor of '54'
set(gca, 'YTick',linspace(min(yt), max(yt), NrYticks), 'YTickLabel',linspace(0, -54, NrYticks))
xlabel('x')
ylabel('y')
zlabel('z')
view(60,30)
% shading('interp')
Experiment to get different results.
.
10 Kommentare
Star Strider
am 11 Jan. 2022
As always, my pleasure!
If you have further questions and have problems figuring out how the code works, don’t struggle longer than necessary. Just ask, and I’ll do my best to provide an appropriate solution (or explain the reason a solution isn’t possible).
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!