Friday 18 May 2018

MATLAB plot of data (spectro) with maximum indicator

load llspectro6.txt
x = llspectro6 (:,1);
y = llspectro6 (:,2);
[Peak, PeakIdx] = findpeaks(y);
plot(x,y, 'cyan', 'Linewidth', 2)
ylabel ('Intensity (Counts)')
xlabel ('Wavelength (nm)')
indexmin = find(min(y) == y);
xmin = x(indexmin);
ymin = y(indexmin);
indexmax = find(max(y) == y);
xmax = x(indexmax);
ymax = y(indexmax);
strmax = ['Maximum = ',num2str(xmax)];
text(xmax,ymax,strmax,'HorizontalAlignment','right');

Friday 12 January 2018

MATLAB data plotting: x vs y plot and x vs y1,y2,y3 etc. plot in single frame

load plot2.txt
x = plot2 (:,1);
y = plot2 (:,2);
plot(x,y, 'r', 'Linewidth', 2)
title('Magnetization plot of 5x5')
ylabel ('Absolute value of Magnetization |M|')
xlabel ('Temperatuire (T)')


load plot2.txt
load plot2.txt
x = plot2 (:,1);
y1 = plot2 (:,2);
y2 = plot2 (:,3);
y3 = plot2 (:,4);
y4 = plot2 (:,5);
plot(x, y1, 'r', x, y2, 'm', x, y3, 'g', x, y4, 'b', 'Linewidth', 2)
title('Specific heat plot of of four lattice sizes')
ylabel ('Specific heat (Cv)')

xlabel ('Temperatuire (T)')