%
% filtersSPD.m
%
% get the transmitivity of the filters
%
%

load spd/filtered_light_spd;

filters_transmitivity = filtered_light_spd;

reference = filtered_light_spd(1,:);
iszero = (reference == 0);
reference(iszero) = 1;

for i=1:18
 filters_transmitivity(i,:) = filters_transmitivity(i,:)./reference;
end

save filters_transmitivity wavelength filters_transmitivity;

figure;
hold on;

% control
for i=1:1
 plot(wavelength, filters_transmitivity(i,:), 'k');
end

% Blue
for i=2:6
 plot(wavelength, filters_transmitivity(i,:), 'b');
end

% Amber
for i=7:11
 plot(wavelength, filters_transmitivity(i,:), 'r');
end

% Green
for i=12:15
 plot(wavelength, filters_transmitivity(i,:), 'g');
end

% Magenta
for i=16:18
 plot(wavelength, filters_transmitivity(i,:), 'm');
end

title('Filters Transmitivity');
xlabel('Wavelength nm');
ylabel('Transmitivity');
hold off;

figure;
hold on;

% Blue
for i=2:6
 plot(wavelength, filters_transmitivity(i,:), 'b');
end

title('Blue Filters Transmitivity');
xlabel('Wavelength nm');
ylabel('Transmitivity');
hold off;

figure;
hold on;
% Amber
for i=7:11
 plot(wavelength, filters_transmitivity(i,:), 'r');
end

title('Amber Filters Transmitivity');
xlabel('Wavelength nm');
ylabel('Transmitivity');
hold off;

figure;
hold on;
% Green
for i=12:15
 plot(wavelength, filters_transmitivity(i,:), 'g');
end

title('Green Filters Transmitivity');
xlabel('Wavelength nm');
ylabel('Transmitivity');
hold off;

figure;
hold on;
% Magenta
for i=16:18
 plot(wavelength, filters_transmitivity(i,:), 'm');
end

title('Magenta Filters Transmitivity');
xlabel('Wavelength nm');
ylabel('Transmitivity');
hold off;

