skyT = readtable('sky_dni_0.csv');
sunT = readtable('sun_dni_0.csv');

sky_wavelengths = table2array(skyT(:, "wavelength"));
sun_wavelengths = table2array(sunT(:, "wavelength"));

sky_counts = table2array(skyT(:, "count"));
sun_counts = table2array(sunT(:, "count"));

sky_maxcount = max(sky_counts);
sun_maxcount = max(sun_counts);

sky_counts = table2array(skyT(:, "count")) / sky_maxcount;
sun_counts = table2array(sunT(:, "count")) / sun_maxcount;

plot(sky_wavelengths, sky_counts);
hold on
plot(sun_wavelengths, sun_counts, '--');

xlabel('Wavelength \lambda (nm)');
ylabel('Counts (Normalised)');

xticks(min(sky_wavelengths):10:max(sky_wavelengths));

grid on

legend({'Sky Spectrum','Sun Spectrum'},'Location','northeast')