Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Spring 2023: CMDA 3606

Math. Modeling II

Submissions must be made through the class Canvas page.  You must follow ALL of the following conventions or you will lose points.

● Students must submit their solutions electronically as a  .pdf upload to the course Canvas site.

● The entire assignment must be submitted as ONE pdf le.

● The Matlab (or Python) scripts need to be attached to the pdf le. Include the code after the corresponding question.  Also, the plots should be included in the pdf le, once again in the answer of the corresponding problem; not in the end. Moreover, the numerical results of the Matlab (or Python) code should also be included in the pdf, once again in the answer of the corresponding problem; not in the end.

● For those who are using LaTeX: The mcode package is great for including MATLAB code in LaTeX. The graphicx package can be used to include images in LaTeX.

● Submitted documents must answer questions in order. If you do not answer a question or part of a question, please indicate this on your assignment.

● Submitted documents must be legible and well organized. If you have to re-copy your solution to make your solution clear, do so.

● Hand-written solutions are acceptable under the following conditions:

– Scanned pages must be properly oriented (the top should be on top).

– The scanned pages must be legible with appropriate contrast.

– The grader reserves the right to mark off for untidy or unclear submitted work. All work must be written (or typed) neatly, with each problem clearly labeled and nal answers clearly indicated.

● LaTeX Extra Credit:  Students can receive 5 points extra credit if the assignment is written using LaTeX. Complete homework solutions must be written using LaTeX.

1. In this question, you will rst formulate the exponential data-fitting problem as a non- linear least-squares minimization, derive the analytical formula for the Jacobian com- putations, and then will implement it numerically.  Derivations are very similar to the examples on Page 1 and Pages 5-6 of the Lecture Notes 22.

We know from CMDA 3605 / MATH 2214 / CMDA 2006 classes that solutions to linear differential equations are a weighted sum of exponentials. Thus, they can be written as

N

y(t) = αj eλjt     where   αj  e C and λj  e C.                            (1)

j|1

We will focus on the simple case that αj  and λj  are real numbers (not complex). In this problem (as we did in class) we do not know αj  and λj .  But we have the samples of y(t). In other words, we have the data

Data:  {y(t1 ), y(t2 ), y(t3 ),  . . . , y(tm )},                                 (2)

where ti  are the sampling points in time. In most cases, due to various reasons such as noise, we will not be able to nd the exact αj  and λj  in (1).  Indeed, we will not even know what N is.  So, our goal is, given the data in (2), to nd the approximate scalars j  and j  for j = 1, 2, . . . , r such that our approximation

r

yˆ(t) = j ejt                                                                                (3)

j|1

matches the data (2) in the least-squares sense.  More precisely, our goal is to nd the scalars j  and j  such that

m

 | y(tk ) . yˆ(tk ) |2

k|1

(a) First we put this problem into the nonlinear least-squares formulation, almost as the same way we did in the two examples in class.

Dene the vector of unknowns x =  1     · · ·   r     1     · · ·   r  ,T  e Rn .  This will be our unknown variables; thus n = 2r .

Show that the nonlinear least-squares error in (4) can be written as

m

| y(tk ) . yˆ(tk ) |2 = lb . g(x)l2 ,

k|1

where b e Rm  represents the data (2) and g(x) e Rm  is the nonlinearity. Explicitly specify what b and g(x) are. This is very similar to what we did in class.

(b)  Our goal is to solve the minimization problem

min lb . g(x)l2

xeR|

using the Gauss-Newton algorithm. As we discussed in class, this requires comput- ing the Jacobian matrix J(x) e Rmxn . Using the analytical formula for g(x) from part-(a), find the analytical expression for the Jacobian matrix J(x).

(c) Now, we have all the tools to implement the Gauss-Newton algorithm.  You will complete the code BonusHomework .m to answer this problem. We will choose r = 2 in our approximation yˆ(t) in (3). Thus, we have

2

yˆ(t) = j ejt  = | e1 t + 2 e2 t ,

j||

 αˆ(αˆ)2(|)  

x =  '(') |    '(') e R4  .

Therefore we have n = 4.

Line 10 of BonusHomework .m loads the data le NonLSdata .mat into your workspace. This contains the vector t of time samples t| , t2 , . . . , t|66 and the corresponding opisy observation data b e R|66 . Thus we have m = 100.

Complete Line 14 for define a function handle for g(x).

For example, if we had g(x) = 22)  , you would define it as

g  =  @(x)  [  x(1)  +  x(2)^2  ;    sin(x(2))]

Similarly complete Line 15 to define the Jacobian J(x).   Lines 17–24 define the stopping criterion, initial estimate etc.   Complete Lines 27–29 to implement the Gauss-Newton method for nonlinear LS.

Complete Line 36 to evaluate your approximation at the given time samples stored in the time vector t. Lines 37–44 plots the given noisy data and your nonlinear LS fit.

How good is your fit? What values did you obtain for the unknowns | , 2 , | , 2 ? Explicitly write down your approximation yˆ(t) using the formula (3).