PS1

profilejmireku77

In the document

  • 3 years ago
  • 10
files (1)

PS11.pdf

Chem 240 Problem Set 1 Makeup

1. For this problem you will fit multi-

exponential decay functions using MATLAB’s fminsearch utility. The dataset can be downloaded and read into your

function that returns 2:

𝜒2~∑(𝑑𝑎𝑡𝑎(𝑖) − 𝑓𝑖𝑡(𝑖))2 𝑁

𝑖=1

of a fit based on your input parameters; see the Ch.3 of “Matlab for the Physical Scientist” for an example for fitting a line.

a. First try fitting a single exponential

decay:

Amplitude = A ∙ e−t τ⁄ (5 pts)

b. Next, use the variance-covariance method to estimate the errors of your fitted

amplitude and time constant, and report your answers as Amplitude ± 𝜎𝑎𝑚𝑝 and 

± 𝜎𝜏. Note that much of this is also worked out in Ch. 3 of “Matlab for the Physical Scientist”. (5 pts) FYI here are some additional MATLAB commands for you to know on plotting data with the optimum fit that you derive using fminsearch: >> plot(prob1(:,1),prob1(:,2),'b')

>> hold on

>> plot(prob1(:,1),fit,'k--') >> xlabel('Time (s)')

>> ylabel('Amplitude')

>> set(gca,'TickDir','out');

2. For this question download this

dataset, which is the same from question one but with a 3rd column that gives you the size of the error bars. Next, repeat the analysis of question 1a using the error bars in the data analysis. To this end, you have to modify your calculation function to include the errors to the data points via:

𝜒2~∑( 1

𝜎𝑖 2) ∙ (𝑑𝑎𝑡𝑎(𝑖) − 𝑓𝑖𝑡(𝑖))2

𝑁

𝑖=1

Plot the data again using the “errorbar” function of MATLAB (see code snippet below) with an overlaying fit to the data. Note that your fitted parameters should be nearly identical to that from problem 1. (5 pts)

FYI, here is some more MATLAB code for you to make a nice figure for this dataset: >> errorbar(prob2(:,1),prob2(:,2),prob2(:,3))

>> xlabel('Time (s)')

>> ylabel('Amplitude')

>> set(gca,'TickDir','out');

b. Now use the errors per data point to calculate 𝜎𝑎𝑚𝑝 and 𝜎𝜏. Please print out

your program and present the results in the form: Amplitude ± 𝜎𝑎𝑚𝑝 and  ± 𝜎𝜏.

(5 pts)

3. For this problem we will fit a signal

that isn’t quite what it appears to be at first.

a. First download the dataset. Next,

use fminsearch to find the optimal parameters for a single exponential decay. Please include a copy of your program with your optimized amplitude and time constant and a graph with the fit. (5 pts)

b. You may have noticed that the fit wasn’t so good. As a result, try an

exponential decay with a linear component:

Amplitude = A ∙ e−t τ1⁄ + B ∙ t (5 pts) For both parts please provide a graph with a fit for your answer, the best fit amplitudes (A&B) and the time constant τ1, and a copy of your programs.

4. a. For this problem, please fit a

Gaussian to this dataset of the intensity of a UV/Vis spectra peak. The function is:

Intensity = A ∙ e−(λ−𝜆0) 2 2𝜎2⁄

where you have to calculate the optimum amplitude A, center wavelength 𝜆0, and sigma (𝜎). As usual please provide a copy of your program and a graph with the data and your fit. (5 pts)

b. Use the variance-covariance method to calculate the errors of the three fitted

parameters and report your answer as : Amplitude ± 𝜎𝑎𝑚𝑝, 𝜆0 ± 𝜎𝜆0, and 𝜎 ± 𝜎𝜎.

Of course provide a copy of your program. (15 pts)

© 2023, Preston T. Snee

This work is licensed under a Creative Commons Attribution-

NonCommercial 4.0 International License.