UV-vis Notebook Example

Al Fischer
Janaury 02, 2020

Introduction

Insert your introduction here. You should write your intro before lab.

Write a short paragraph about the purpose of the lab, the technique(s) you're using, the samples you're analyzing, and any additional background information you can think of that will help frame the purpose of the lab. At minimum you should include and overview (not detail) of:

  • What the sample/analyte is
  • The technique(s) you are using

Materials and Methods

Fill in all of the exact details necessary for you to repeat the study without any additional resources.

Much of this section should be filled in during lab!

Materials

  • Insert chemicals/materials here.

Sample Preparation

  1. Insert step-by-step procedures here.
  2. Next step...

Standard & QC Preparation

Standards


In [1]:
###### Use this function to calculate stand concentrations. ############################
## Leave the function alone 
function concentrations = serialDilution(stock, pipettes, flasks)
    concentrations =[];
    for i = 1:length(pipettes)
        if i == 1
            concentrations(i) = stock * pipettes(i)/flasks(i);  # calculate first dilution
        else
            concentrations(i) = concentrations(i-1) * pipettes(i)/flasks(i); # calculate all other dilutions
        end
    end
    concentrations = flip(concentrations)'; # reverse the vector from lowest to highest and transpose to column vector
end
########################################################################################

In [ ]:
####### Insert standard info here ######################################################
## insert correct values as arguments to serialDilution() below
concentrations = serialDilution(stock, pipettes, flasks); # conc in ppm, volume of pipettes in ml, vol of flasks in ml 

disp("Standard Concentrations (in ppm) = ");
output_precision(4); # display 4 sig figs - change if needed
disp(concentrations);

Quality Control


In [ ]:
######## Insert QC Info Here ############################################################
qc_stock   = 100.6;  # units: ppm, insert concentration of the stock soln. used for QC
qc_pipette = 10;     # units: ml
qc_flask   = 50;     # units: ml (must be same length and units as 'qc_pipette')
########################################################################################

qc_conc    = qc_pipette / qc_flask * qc_stock;
disp("QC Concentration (in ppm) = ");
output_precision(4);  # display 4 sig figs - change if needed
disp(qc_conc);

Instrumentation

Students: Fill in the instrument settings table. Look up the values on the Vernier website.

Table 2: Instrument Settings
Parameter Value
Make & Model Vernier SpectroVis
Source (fluorescence)
Optical Resolution
Wavelength Range
Data Acquisition Software

Methods

Results and Data Analysis

The code below should help you get started with the data analysis. You will need to add explanations and interpretations between many of the chunks to clarify the process.


In [ ]:
#### Import the data
## Input your datafile name (and/or path) in the csvread() function below
X = csvread('data/your-datafile-name.csv'); ## import data
X(1:2, :) ## print to screen to make sure data imported OK (optional)

In [ ]:
wavelengths = X(:, 1); ## extract wavelength column to it's own vector
X = X(:, 2:2:end); ## extract even columns (intensity columns) and discard wavelength columns
X(1:2, :) ## print to screen to make sure clean up worked as expected (optional)

In [ ]:
##### Plot the emission spectrum

plot(wavelengths, X(:, 5), 'DisplayName', 'Name of Sample');
xlabel('Wavelength (nm)');
ylabel('Intensity (arbitrary)');
xlim([380 700]); ylim([0 0.25]);
hold on
plot(wavelengths, X(:, 9), 'DisplayName', 'Name of Sample');
legend();
hold off

In [ ]:
##### find max emission wavelength #######################
[max_values indices] = max(X(:, 5));
lambda_max = wavelengths(indices);
disp("Wavelength of maximum emission (in nm) = ");
output_precision(0); # only display to nearest nm
disp(lambda_max);

In [ ]:
disp("The intensities at the analytical wavelength are:")
intensity_values =  X(wavelengths == (lambda_max), :)

In [118]:
##### Define function to calculate linear fit and R2 ###############################
##### Leave this section alone

function [fit_params, r2, fitline] = fitlm(x, y)
    X = [ones(length(x), 1) x];
    fit_params = (pinv(X'*X))*X'*y;
    # watch this video to understand this code: https://www.youtube.com/watch?v=w2FKXOa0HGA
    ss_tot = sum((y - mean(y)).^2);
    ss_reg = sum(((X*fit_params) - mean(y)).^2);
    r2 = ss_reg/ss_tot;
    fitline = [x, X*fit_params];
end
#####################################################################################

In [ ]:
standards = intensity_values(4:6) .- intensity_values(1); ## subtract blank reading 
### (Choose the correct columns above by number)

##### Plot Data

plot(concentrations', standards', '*', 'DisplayName', 'Experimental Data');
xlabel('Concentration (ppm)');
ylabel('Intensity (arbitrary)');

##### Calculate linear model / cal curve
[fit_params, r2, fitline] = fitlm(concentrations, standards');

##### Plot cal curve
hold on; # this keeps our previous plot of the training data visible
plot(fitline(:, 1), fitline(:, 2), 'b--', 'DisplayName', 'Linear regression')
legend('location', 'northwest')
hold off # Don't put any more plots on this figure

##### print values to screen
output_precision(4); # only display to 4 sf
disp("Slope =")
disp(fit_params(2))
disp("Intercept =")
disp(fit_params(1))
disp("R2 =")
disp(r2)

Determine Concentrations


In [120]:
###### Calculate concentration of samples & QC

samples_qc = intensity_values(7:12) .- intensity_values(1); ## Subtract blank - Choose the correct columns here by number
concs = ### insert code here to calculate concentrations

In [ ]:
###### Calculate mean QC value
mean_qc = mean(concs(1:3));   ## Choose correct QC columns
sd_qc   = std(concs(1:3));    ## Choose correct QC columns
qc_percent_diff = ## Insert code here to calculate percent difference

output_precision(1);  # display 1 decimal - change if needed

disp("Avearge  [Quinine] in QC (in ppm) = ");
disp(mean_qc);

disp("Expected [Quinine] in QC (in ppm) = ");
disp(qc_conc);

disp("QC Difference in percent = ");
disp(qc_percent_diff);

In [ ]:
###### Calculate mean sample values

mean_samples = ## Calculate sample mean here
sd_samples = ## Calculate SD here

# Display average sample conc.
disp("Avearge  [Quinine] in sample (in ppm) = ");
disp(mean_samples);

## Display sample SD.
##### Fill in code here

## Display sample RSD
##### Fill in code here

Limits of Detection and Quantitation


In [130]:
mean_blank = mean(intensity_values(1:3)); ## Choose correct blank columns
sd_blank   = std(intensity_values(1:3));  ## Choose correct blank columns

## Do calculations here...

Conclusion

Insert your conclusion here. You should state what you found and whether or not the results seem accurate. Be sure to include the percent composition of your sample in the conclusion. Also discuss the polarity the compounds relative to each other.

References

[1] Insert references here in ACS format.