User:EGM6341.s11.TEAM1.HW7

Problem 0: Rework Cauchy Distribution part of 5.2 and 5.4
Solved without assistance 

Given: Linear State Space Model
Given the following:

Find: Model plot with various random noise
A.) Run model and plot $$\underline{x} _0 \ $$ B.) Find the equilibrium point as $$ \lim_{k \to \infty} \underline{x} _{k+1} = \lim_{k \to \infty} \underline{F} ^{k+1} \underline{x} _0 =: \underline{\hat{a} } $$ C.) Use MATLAB randn to generate $$ \begin{Bmatrix} w_j \end{Bmatrix} $$, for $$ j=0,1,2,... \ $$ and plot $$ \begin{Bmatrix} \underline{x} _j \end{Bmatrix} $$, for $$ j=0,1,2,... \ $$. Use a big blue dot for $$ j=0 \ $$, use small dots for the other points. All for $$ \alpha\ = 0.5 $$, $$ \alpha\ = 1 $$  and  $$ \alpha\ = 2 $$ D.) Run model with Cauchy random noise and plot $$\underline{x} _0 \ $$

Run linear state space model
The following MATLAB (v2009b) code was developed to evaluate the state space model until an equilibrium point was reached. The results are shown in Figure 5.2.1.


 * Nm1.s11.team1.HW4.fig5.2.1.png

Find equilibrium point
In order to determine the equilibrium point, the Euclidean distance between the next $$x_{n+1} \ $$ and $$ x_{n} \ $$ was calculated for each step in the model. In this case, the Euclidean distance is defined as:

When this distance became less than $$ 10^{-6} \ $$, the equilibrium point was taken as "found".

The MATLAB code presented above displays the equilibrium point, which is also plotted in Figure 5.2.1 above.

Cauchy Random Noise
The following MATLAB (v2009b) code was developed to evaluate the state space model for 1000 iterations, since an equilibrium point was not reached. The results are shown in Figure 5.2.2.


 * Nm1.s11.team1.HW4.fig5.2.3NEW.png

Problem 4: Spring and Dampener system
Solved without assistance 

Find: Equation of the motion and control scheme
A.) Equation of motion B.) State space model of system C.) $$c_{cr}$$ D.) Plot $$x_k \ $$ for $$c=\frac{1}{2}c_{cr},c_{cr},\frac{3}{2}c_{cr} $$, and with Gaussian and Cauchy noise.

Equation of motion
The system(Spring-mass-damper) equation can be defined as,

Each of the elements are

Plugging each of the elements in to the eq4.1 becomes EOM(Equation of the motion) as

Define state space model
State space

Applying the given expression on p29-7, Eq(4):

Rewriting to discrete system equation, as

where I is the identity matrix, and A, B, and h are defined as above

Critical damping
Frequency and damping ratio are given as

Thus,

Part3. With Cauchy noise


 * [[File:Nm1 s11 team1 HW7 p0.png|1000px|center|thumb|Figure 7.0.1: [x1,x2]' trajectory and x1,x2 vs time response]]

Problem 1: Use Hermite Simpson algorithm to integrate $$ \frac{dx}{dt}=rx \left ( 1-\frac{x}{x_{max}} \right ) \ $$
Referenced last years work

Given
$$ x_{max}=15 \ $$ $$ r=1.4 \ $$ 2 cases: $$ x_0=3 < \frac{1}{2}x_{max} \ $$ and $$ x_0=9 > \frac{1}{2}x_{max} \ $$ for $$ t \in [0,10] \ $$

case 1: $$ x_0=3 \ $$
 * Hw7 p2 team 1.png

case 2: $$ x_0=9 \ $$
 * Hw7 p2 team 1 1.png

Problem 2: Solve parameters for Equation of Motion
Referenced the work of Team 3, Spring 2010.

Improvements: -Added display of absolute error to user can monitor progress of convergence -Code restructured, variables renamed, and additional comments and to make code easier to follow and inputs easier to change -Improved parts of code to reduce time for absolute error to converge to $$10^{-6}$$ -->Old code time: Longer than 1 hour -->This code time: 107 sec

Given
Equations of motion for an aircraft:

where

and

Physical parameters were taken from the Subchan and Zbikowski paper:

Initial conditions were taken from the Subchan and Zbikowski paper:

Values for the controls are given in [[media:Egm6341.s10.mtg41.djvu|S10 Mtg 41]]: $$ \underline{u} (t)= \left \lfloor T(t), \alpha\ (t) \right \rfloor \ $$

Find: z and J
Solve to find the matrix $$z \ $$ for the bunt maneuver using S10 and S11 values, as well as values for $$ J \ $$ such that:

$$ J= \int_{0}^{t_f} y(t)\, dt \ $$ such that $$ y(t_f)=0 \ $$

Solve: Using S10 values
The following MATLAB code was developed to solve for $$\underline{z} \ $$ using Newton-Raphson and Hermite-Simpson:

The solution was confirmed using the MATLAB command ode45:



Solve: Using S11 values
The different values of $$\alpha \ $$ used for the S11 solution are shown below:

The following MATLAB code executes the model using these new values of $$\alpha \ $$:



Solve: Compare J values
The following MATLAB code was used to use the MATLAB trapz command to integrate the output of Parts 1 and 2 and determine $$ J_1 \ $$ and $$ J_2 \ $$.

$$J_1 = 16860 \ $$ $$J_2 = 10824 \ $$

Meaning that since $$ J_2 < J_1 \ $$, the S11 values provide a better solution.

Problem 3: Solving the Logistic Equation Using Inconsistent Trap-Simpson's rule & Newton-Raphson
Solved without assistance 

Given
Refer Lecture slide 41-1 for problem statement

The logistic equation for population dynamics is given by


 * {| style="width:100%" border="0" align="left"

$$\displaystyle \dot{x}(t) = f(x) = rx \left(1-\frac{x}{x_{max}}\right) $$ $$      (7.1)
 * $$\displaystyle
 * 
 * }

Here, $$\displaystyle x_{max}=15;\ r = 1.4,\ $$ and $$\displaystyle t \in [0,20] $$

The analytical solution is given by the S10 lecture note38-3 as following;


 * {| style="width:100%" border="0" align="left"

$$\displaystyle x(t) = \frac{x_0x_{max}e^{rt}}{x_{max} + x_0(e^{rt}-1)} $$ $$      (7.2)
 * $$\displaystyle
 * 
 * }

Logistic equation defined by eqn 7.1 for two initial conditions, $$\displaystyle x_0=3\ and\ x_0 = 9,\ $$, can be solved by using Inconsistent(trapez.) Simpson's rule given by the s10 lecture note 38-3,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle z_{i+1} = z_{i} + \frac{h/2}{3} \left[f_i + 4f_{(i+1/2)} +f_{i+1}\right] $$ $$      (7.3)
 * $$\displaystyle
 * 
 * }

The Inconsistent rule (Trapezoidal) is given by,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle z_{i+1/2} = \frac{1}{2} [z_{i} + z_{i+1}] $$      (7.4)
 * 
 * }

Solution
By considering the eqn 7.1 in which $$\displaystyle f_{(i+1/2)}$$ is a function of $$\displaystyle z_{i}$$ and $$\displaystyle z_{i+1}$$, where $$\displaystyle z_i, z_{i+1} \rightarrow$$ values of $$\displaystyle x$$ at $$\displaystyle t = t_i$$ and $$\displaystyle t = t_{i+1}$$. This is an initial value problem, $$\displaystyle z_i$$ is known. So, eqn 7.3 as a whole becomes a function of $$\displaystyle z_{i+1}$$ given by,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle F(z_{i+1}) = 0 $$ $$      (7.5) $$\displaystyle z_{i+1}$$ of eqn 7.5 can be found by using Newton-Raphson method
 * $$\displaystyle
 * 
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle z_{i+1}^{(k+1)} = z_{i+1}^{(k)} - \left[\frac{dF(z_{i+1}^{(k)})}{dz}\right]^{-1} F(z_{i+1}^{(k)}) $$ $$      (7.6) The Newton-Raphson iteration, starting with an initial guess as $$\displaystyle z_{i+1}^{0} = z_{i}$$, is stopped once the absolute tolerance reaches appropriate criterion.
 * $$\displaystyle
 * 
 * }


 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} AbsTol &= ||z_{i+1}^{(k+1)} - z_{i+1}^{(k)}|| \le 10^{-6} \end{align} $$
 * }
 * }

$$\displaystyle x_0 = 3 $$ :- A comparison on $$\displaystyle h $$ values:



$$\displaystyle x_0 = 9 $$ :- A comparison on $$\displaystyle h $$ values:



=Contributing Members & Referenced Lecture=