%IMPORTANT READ FIRST: %This script requries the functions sensor.m, source.m, and gauss.m to operate successfully. It also requires the emission %and excitation data Emission.csv and Excitation.csv. Make sure that these functions and the data %are within the path of the script. The script will only ask for an efficiency of the LED to Tryptophan conversion. %afterwords, the script will plot the unfiltered emission data and the filtered emission data on a seperate plot, along with %any complementary graphs. clear clc %%unfiltered data %load the emission and excitation data into matlab emission = csvread('Emission.csv'); excitation = csvread('Excitation.csv'); %normalize both the emission and excitation plots emission_norm = emission; emission_norm(:,2) = emission_norm(:,2)/max(emission_norm(:,2)); excitation_norm = excitation; excitation_norm(:,2) = excitation_norm(:,2)/max(excitation_norm(:,2)); %Get the user input. How efficient is the Tryptophan? This value will be %changed to a permenate value once experimentally found. efficiency = input('What percentage of the light is transmitted? (50, 70...)'); emission_norm(:,2) = emission_norm(:,2)*(efficiency/100); %obtain the emitter data. The wavelength values are spaced 1 nm from %200-400 nm. This goes for the emitter and reciever values. x = 200:400; LED = source(x,280,10); photodiode = sensor(x); %normalize the emitter and reciever values LED_norm = LED./max(LED); photodiode_norm = photodiode./max(photodiode); %Obtain LED and tryptophan data as seen by the UV sensor. The normalized data will %be used in this instance. LED_sensed = LED_norm .* photodiode_norm; emission_wav = emission_norm(:,1)'; emission_sensed = emission_norm(:,2)' .* sensor(emission_wav); %Determine the relative strength of each signal. Compute the area under the %curve for each LED_strength = sum(LED_sensed * (x(2)-x(1))); emission_strength = sum(emission_sensed * (emission_wav(2)-emission(1))); %plot both the normalized excitation and emission data on the same plot. %Column 1 is the wavelength data and column 2 is the relative intensity subplot(2,2,1) plot(emission_norm(:,1),emission_norm(:,2),excitation_norm(:,1),excitation_norm(:,2)) axis([200 500 0 1]) xlabel('wavelength (nm)') ylabel('relative intensity') legend('emission','excitation') title('Emission vs Excitation') %plot the normalized source and normalized reciever subplot(2,2,2) plot(x,LED_norm) axis([200 400 0 1]) xlabel('wavelength (nm)') ylabel('relative intensity') title('LED intensity') %plot of the normalized sensor sensitivity subplot(2,2,3) plot(x,photodiode_norm) axis([200 400 0 1]) xlabel('wavelength (nm)') ylabel('relative sensitivity') title('Sensor sensitivity') %plot of the LED and tryptophan plots as seen by the sensor subplot(2,2,4) plot(x,LED_sensed,emission_wav,emission_sensed) axis([240 400 0 0.6]) xlabel('wavelength (nm)') ylabel('relative sensitivity') title('LED vs Tryptophan Strength') legend('LED','Tryptophan') text(265,0.5,['LED = ',num2str(LED_strength)]) text(335,0.3,['Tryptophan = ',num2str(emission_strength)]) %%Filtered data the first filter is gaussian centered at 340nm with 10nm %%bandwidth %The optical filter will be modeled off of the given 'source' function. %Source.m takes the variables x, wavelength, and bandwidth filter_x = source(x,340,10)/(max(source(x,340,10))*4); %filter centered at 340nm and BW of 10nm. Maximum of 25% pass through filter_em = source(emission_wav,340,10)/(max(source(emission_wav,340,10))*4); %both these lines are necessary due to different lengths filtered_LED = LED_sensed .* filter_x; filtered_emission = emission_sensed .* filter_em; filtered_emission_strength = sum(filtered_emission * (emission_wav(2)-emission_wav(1))); %Improved filter is denoted as filter_y filter_y = flourescent_filter(x); filter_em_y = flourescent_filter(emission_wav); filtered_LED_y = LED_sensed .* filter_y; filtered_em_y = emission_sensed .* filter_em_y; filtered_em_y_strength = sum(filtered_em_y * (emission_wav(2)-emission_wav(1))); %Plot the above data figure %first filter subplot(2,2,1) plot(x,LED_sensed,emission_wav,emission_sensed,x,filter_x) %axis([320 360 0 1]) xlabel('wavelength (nm)') ylabel('transmission') title('First Filter Characteristics') %filter response subplot(2,2,2) plot(x,filtered_LED,emission_wav,filtered_emission) %xlim([260 400]) xlabel('wavelength (nm)') ylabel('relative intensities') title('LED vs Tryptophan Strength') legend('Filtered LED','Filtered Tryptophan') text(350,max(filtered_emission)*(2/3),['Filtered Tryptophan = ',num2str(filtered_emission_strength)]) %second filter subplot(2,2,3) plot(x,LED_sensed,emission_wav,emission_sensed,x,filter_y) xlabel('wavelength (nm)') ylabel('transmission') title('Second Filter Characteristics') %filter response subplot(2,2,4) plot(x,filtered_LED_y,emission_wav,filtered_em_y) xlabel('wavelength (nm)') ylabel('relative intensities') title('LED vs Tryptophan Strength') legend('Filtered LED','Filtered Tryptophan') text(375,.08,['Filtered Tryptophan = ',num2str(filtered_em_y_strength)])