Graph related issue XRD output
1 view (last 30 days)
Show older comments
Dear Community,
Any one can help me please, I am exporting XRD results in MATLAB and my graph is not looking perfect I dodnt know where did i mistakes? I am going to be share my entire matlab code as well as Raw file, Any one can help me to trace my mistakes! Thanks
%This is Matlab Code%
%% Import the data
[~, ~, A] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
A = A(3:end,2);
[~, ~, B] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
B = B(3:end,5);
[~, ~, Time] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
Time = Time(3:end,1);
[~, ~, C] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
C = C(3:end, 8);
[~, ~, D] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
D = D(3:end, 11);
[~, ~, E] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
E = E(3:end, 14);
[~, ~, F] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
F = F(3:end, 17);
[~, ~, G] = xlsread('G:\E-book store\Mechanical Engineering\Master of Engineering\Thesis\XRD-3\Raw Data.xlsx','Sheet1');
G = G(3:end, 20);
%% Create output variable
AData = reshape([A{:}],size(A));
AData = AData + 500;
BData = reshape([B{:}],size(B));
BData = BData + 1000; %This moves the line down 500 units
CData = reshape([C{:}],size(C));
CData = CData + 1500; %This moves the line down 500 units
DData = reshape([C{:}],size(C));
DData = DData + 2000; %This moves the line down 500 units
EData = reshape([C{:}],size(C));
EData = EData + 2500; %This moves the line down 500 units
FData = reshape([C{:}],size(C));
FData = FData + 3000; %This moves the line down 500 units
GData = reshape([C{:}],size(C));
GData = GData + 3500; %This moves the line down 500 units
TimeData = reshape([Time{:}],size(Time));
%% Clear temporary variables
clearvars A;
clearvars B;
clearvars Time;
clearvars C;
clearvars D;
clearvars E;
clearvars F;
clearvars G;
figure()
hold on
[AMAX AMAXMAG] = peakfinder(AData)
AZ = zeros(1,length(AData));
for i=1:length(AMAX)
AZ(AMAX(i)) = 1;
end
AZ = logical(AZ);
[BMAX BMAXMAG] = peakfinder(BData)
BZ = zeros(1,length(BData));
for i=1:length(BMAX)
BZ(BMAX(i)) = 1;
end
BZ = logical(BZ);
[CMAX CMAXMAG] = peakfinder(CData)
CZ = zeros(1,length(CData));
for i=1:length(CMAX)
CZ(CMAX(i)) = 1;
end
CZ = logical(CZ);
[DMAX DMAXMAG] = peakfinder(DData)
DZ = zeros(1,length(DData));
for i=1:length(DMAX)
DZ(DMAX(i)) = 1;
end
DZ = logical(DZ);
[EMAX EMAXMAG] = peakfinder(EData)
EZ = zeros(1,length(EData));
for i=1:length(EMAX)
EZ(EMAX(i)) = 1;
end
EZ = logical(EZ);
[FMAX FMAXMAG] = peakfinder(FData)
FZ = zeros(1,length(FData));
for i=1:length(FMAX)
FZ(EMAX(i)) = 1;
end
FZ = logical(FZ);
[GMAX GMAXMAG] = peakfinder(GData)
GZ = zeros(1,length(GData));
for i=1:length(GMAX)
GZ(GMAX(i)) = 1;
end
GZ = logical(GZ);
plot(TimeData, AData)
plot(TimeData, BData)
plot(TimeData, CData)
plot(TimeData, DData)
plot(TimeData, EData)
plot(TimeData, FData)
plot(TimeData, GData)
plot(TimeData(AZ),AData(AZ),'b*')
plot(TimeData(BZ),BData(BZ),'s')
plot(TimeData(CZ),CData(CZ),'o')
plot(TimeData(DZ),CData(DZ),'b')
plot(TimeData(EZ),CData(EZ),'o')
plot(TimeData(FZ),CData(FZ),'o')
plot(TimeData(GZ),CData(GZ),'o')
set(gca,'ytick',[])
legend('BFO\_300C\_1H','BFO\_700C\_5H', 'BFO\_800C\_5H','BFO\_900C\_5H','BFO\_1000C\_5H','BFO\_700C\_10H','BFO\_900C\_24H')
title('Title text')
xlabel('Position 2\theta in the range of 15 to 20')
ylabel('Intensity (a.u.)')
hold off
Expected Results(Graph)

Arrived Results

Raw data file is attached along with this question please help me!
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!