. 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)

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 22?

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.

× How can I help you?