5DV005 Lab1-The function range rk1 Solved

30.00 $ 15.00 $

Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment


5/5 - (1 vote)

Problem 1 Within MATLAB do:

  1. Issue the command help bal. This prints a summary of the MATLAB files contained in the folder bal. These files are for solving problems in external ballistics, i.e. fire control of artillery.
  2. Issue the command help range rk1 and read through the documentation in detail.
  3. Execute the minimal working example range rk1 MWE1.

Remark 1 The function range rk1 demonstrates the standard that is expect from you! In particular, all your codes must contain the call sequence, a complete description of all input and output variables, as well as a minimal working example. Moreover, all code must contain frequent and helpful comments. Software which does not adhere to this standard will not be accepted.

Problem 2 Copy the script lab1/scripts/l1p2.m into lab1/work/my l1p2.m. Your task is to modify my l1p2.m so that it produces the output shown in Figure ?? and renders the graphics shown in Figure ??. These are the MATLAB commands which you will need: fprintf, plot, axis equal, xlabel, ylabel, grid, axis, print.

Flag           Range (meters)               TOI (seconds)

1                 16844.662                      66.33

1                 14998.963                      81.57

Figure 1: The output of l1p2 after completion.

Elevation 45 degrees

Elevation 60 degrees

0                                    2000 4000 6000 8000 10000 12000 14000 16000 18000

x coordinate (meters)

Figure 2: The trajectory of a two shells fired at using elevations of 45 degrees and 60 degrees

Remark 2 In general, I recommend that you export figures from MATLAB at .eps files. You can convert the file fig.eps to .pdf format using the command ps2pdf -DEPSCrop fig.ps. This crops the white space and produces a file called fig.pdf.

Problem 3 As demonstrated during yesterday’s lecture the problem of computing a sum of positive numbers

is substantially more complicated than it would appear! This exercise illustrates highlights the problem and shows how calculate an upper bound for the error.

  1. Copy the script lab1/scripts/l1p3.m to lab1/work/my l1p3.m.
  2. Edit my l1p3 so that it uses simple sum to compute

using single/double precision and ascending/descending order, a total of 4 different calculations.

  1. Edit my l1p3 so that compute the error associated with each value of s. An exceedingly accurate value of the true sum s can be obtained using double precision and the function kahan sum.
  2. Copy function simple sum to lab1/work/my simple sum.
  3. Edit my simple sum to include the computation of a running error bound Eb, such that

|s sˆ| ≤ Eb,       Eb = µu

where s is the true value of the sum, ˆs is computed value of s and u is the unit roundoff, see [?], Section 4.3, Algorithm 7. Be mindful of the fact that u = 2−24 in single precision and u = 2−53 in double precision.

  1. Edit my l1p3 so that it displays the running error bound right next to the actual error.
  2. Verify that the absolute value of the error is bounded by the running error bound.
  3. Which order of summation is the most accurate?
  • lab1-vdhpan.zip