Friday, August 20, 2021

Engineering Simulations and Computations

Particle Kinematics

The x and y positions of Particles 1, 2 and 3, which are measured in the time range of 0 to 2π seconds, are stored in File <A1_input.txt>.


                     Particle#1               Particle#2                 Particle#3 

                  ------------------          ------------------           ----------------- 

Time           x                y             x               y              x              y 

  (s)           (m)            (m)          (m)           (m)           (m)          (m) 

0.0000   +2.1909     0.0000   +2.6833     0.0000   +2.9665     0.0000 

0.0675   +2.1818   +0.1474   +2.6738   +0.1807   +2.9567   +0.1998 

0.1346   +2.1547   +0.2919   +2.6457   +0.3584   +2.9276   +0.3966 

.............................................................................................................

6.2157   +2.1818    -0.1474   +2.6738    -0.1807   +2.9567    -0.1998 

6.2832   +2.1909     0.0000    +2.6833     0.0000   +2.9665     0.0000 


The first column is used to store time, while columns 2k and 2k + 1 are used to store the corresponding x and y positions of Particle kk = (1,2,3). For example, columns 2 and 3 contain the x and y values for the first particle (k = 1). The positions of the three particles are all periodic functions of time with a period of 2π. Your task is to find the velocities and accelerations of the three particles.

The mathematical relationships between the positions, velocities and accelerations of a particle are given by

vx = dx/dt, ax = dvx/dt, (1)
vy = dy/dt, ay = dvy/dt, (2)

where t is the time, vx and vy are the two components of the velocity vector, and ax and ay are the two components of the acceleration vector.
In this assignment, the following equations are to be used to estimate the velocities and accelerations of the particle:

vx1 = (x1 − xN1)/(tN − tN1), vy1 = (y1 − yN1)/(tN − tN1), (3)
ax1 = (vx1 − vxN1)/(tN tN1), ay1 = (vy1 vyN1)/(tN − tN1), (4)

for the first time point t1, and

vxi = (xi − xi1)/(ti ti1), vyi = (yi − yi1)/(ti ti1), (5)
axi = (vxi − vxi1)/(ti ti1), ayi = (vyi − vyi1)/(ti ti1), (6)

for the remaining time points ti, i = (2,3,···N), N is the number of time points in the data file. In equations (3)-(6), xi = x(ti) (value of function x(t) at time ti), yi = y(ti), vxi = vx(ti), vyi = vy(ti), axi = ax(ti) and ayi = ay(ti).

Requirements
For this assessment item, you must perform hand calculations:
1. Use equations (5)-(6) to calculate values of vx and ax at time points t5,t6,t7 and t8 for Particle 1. Report the answers in engineering conventional form.
2. From the equations used in Requirement 1, derive the following matrix systems (variables (unknowns to be found) on LHSs and numbers on RHSs)

vx = Dv.x, (7)

where x = (x4,x5,x6,x7,x8)T , vx = (vx5,vx6,vx7,vx8)T , T is the transpose operator and
Dv is the matrix of size 4-by-5 (called the differentiation matrix), and

ax = Da.vx, (8)

where vx = (vx4,vx5,vx6,vx7,vx8)T , ax = (ax5,ax6,ax7,ax8)T , and Da is the differentiation
matrix of size 4-by-5.
3. Compare Dv and Da (are they identical or different?), and explain the reasons for it.
You must also produce MATLAB code which:
4. Repeats Requirement 1, where the input data are entered into your Matlab program by typing/copying relevant values from the data file. Verify the answers by using the reported results from Requirement 1.
5. Loads the data file into Matlab (the numbers are not to appear in Matlab code via copy-and-paste!). Verifies that the load has been successful by using Matlab to compare the first (t = t1) and last (t = tN ) rows of the numerical data table to those manually entered.
Ensure that you don’t use absolute paths, e.g.
<C:\Users\User\My Documents\filename.txt>,
since that is not the folder in which your assignment will be marked. Use relative paths, e.g. <A1_input.txt>.
6. Plots the trajectories of the three particles on the same graph.
7. Uses equations (3)-(6) to compute vxi , vyi , axi , ayi for Particle 1, where the index i runs continuously from 1 to N (i.e. i = (1,2,··· ,N)) and the calculations are conducted in loops (scalar-/loop-based code). Verify the answers by comparing the results obtained at (t5,t6,t7,t8) with those from Requirement 4.
8. Uses equations (3)-(6) to compute vxi , vyi , axi , ayi for Particle 1, where the index i runs continuously from 1 to N (i.e. i = (1,2,··· ,N)), and the equations are first written in the following matrix forms

vx = Dv.x, (9)
vy = Dv.y, (10)
ax = Da.vx, (11)
ay = Da.vy, (12)

and the solutions are then obtained by multiplying matrices and vectors (vectorised code).
In systems (9)-(12), D is the N ×N differentiation matrix, and x, y, vx, vy, ax and ay
are vectors of length N,

x = (x1,x2,··· ,xN )T , y = (y1,y2,··· ,yN )T , (13)
vx = (vx1,vx2,··· ,vxN )T , vy = (vy1,vy2,··· ,vyN )T , (14)
ax = (ax1,ax2,··· ,axN )T , ay = (ay1,ay2,··· ,ayN )T . (15)

Verify the answers with those from Requirement 7.
9. Plots functions x(t), vx(t) and ax(t) on the same graph and check qualitatively the mathematical relationships between the three functions.
10. Plots functions y(t), vy(t) and ay(t) on the same graph and check qualitatively the mathematical relationships between the three functions.
11. Uses equations (3)-(6) to compute vxi , vyi , axi , ayi for the three particles, where the index i runs continuously from 1 to N (i.e. i = (1,2,··· ,N)) and the calculations are carried out without using loops. Note that this Requirement is independent from Requirements 7 and 8 (Particle 1 is also included in the program here). Verify the answers by comparing the results obtained for Particle 1 with those from Requirement 7.
12. Produces an ASCII file that stores the computed values of the x and y velocities at all time points (t1,t2,··· ,tN ) for the three particles (1 column for time and 6 columns for velocities), where the task of writing data is conducted in loops (loop-based code) and the numeric values are rounded to 3 significant figures.
13. Produces an ASCII file that stores the computed values of the x and y accelerations at all time points (t1,t2,··· ,tN ) for the three particles (1 column for time and 6 columns for accelerations), where the task of writing data is implemented without using loops (vectorised code) and the numeric values are rounded to the fourth decimal place.
14. Has appropriate comments throughout.

Report (Hand calculations + MATLAB code)

40 EUR 

PayPal

If there is a smooth and tidy way ahead, passing from the old rocky roads is not recommended. (Weierstrass)