- Questions & Answers
- Accounting
- Computer Science
- Automata or Computationing
- Computer Architecture
- Computer Graphics and Multimedia Applications
- Computer Network Security
- Data Structures
- Database Management System
- Design and Analysis of Algorithms
- Information Technology
- Linux Environment
- Networking
- Operating System
- Software Engineering
- Big Data
- Android
- iOS
- Matlab

- Economics
- Engineering
- Finance
- Thesis
- Management
- Science/Math
- Statistics
- Writing
- Dissertations
- Essays
- Programming
- Healthcare
- Law

- Log in | Sign up

Numerical Algorithms

and Programming

AM10NP

Yordan Raykov

Group Assessment

To be handed in on or before May XXXXXXXXXX

In AM10NP, we have learnt the introductory concepts of programming such as: how to read

information from files; how to store it in an array, how to display information, as well as, how

to iterate through data, include conditions and execute basic numeric algorithms which can be

iterative in nature. This assessment provides you with an opportunity to reveal these obtained

skills in addressing real-world challenges common today.

Question 1: Together with the coursework instructions, you will find a file named smartphone.txt:

the file contains raw measurements from an accelerometer placed in a smartphone device. The

data contains 4 columns: column 1 records the times at which measurements are collected,

columns 2, 3 and 4 record the x-axis, y-axis and z-axis of measured acceleration in the device.

• Load the accelerometer data from a file to an arrays ti and ai containing the first axis

and the second-fourth axis of the file. Create a plot of the measured acceleration against

time, i.e. display each column of ai against ti.

• Implement a for loop which passes through each element of the array ti and stores the

difference of two successive elements in array df(i), i.e. df(i) = |ti(i+1) −

ti(i)|. Display a histogram of df.

• Create an array ti un which includes equally spaced values between min(ti) and

max(ti), i.e. uniformly time index. Use the MATLAB function interp1 to interpolate

the arrays ai(:,1), ai(:,2) and ai(:,3) from the known times ti to the desired

times ti un. Display your result by plotting the iterpolated arrays ai interp(:, 1),

ai interp(:,2) and ai interp(:,3) on a single plot.

• For each axis ai interp(:,1), ai interp(:,2) and ai interp(:,3) esti-

mate an unknown piecewise linear trend g from the data which satisfies the following

criteria:

minimize

g∈R

‖ai− g‖22 + λ‖Dg‖22 (1)

where λ is a user-defined hyperparameter and you can use that the matrix D ∈ R(n−2)×n

is known as the second-order difference matrix, defined as:

D =

1 − XXXXXXXXXX . . .

0 1 −2 1 0 0 . . .

0 0 1 −2 1 0 . . .

. . .

. . .

XXXXXXXXXX −2 1

(2)

with n being the length of the array ai and all off-diagonal elements being 0.

• Create an array ai filt = ai − g using the estimated g from above. Display a figure

with the following 3 subplots: subplot(1) plotting the array ai against time in seconds;

subplot(2) plotting the estimated array g against time; subplot(3) plotting the filtered array

ai filt. Save a .txt file which stores the filtered array ai filt.

Question 2: Data on the viscosity of water as a function of temperature are given below,

where T is the temperature in degrees Celsius and ν is the viscosity in mPa·sec:

Ti XXXXXXXXXX XXXXXXXXXX

νi XXXXXXXXXX XXXXXXXXXX 0.32

It is desired to determine which of the following two models is appropriate for the above data:

model 1:v(T ) = exp (c0 + c1T )

model 2:v(T ) = exp

(

c0 + c1T + c2T

2

) (3)

(a) Using the basis-functions method, fit both models to the given data and determine the ci

coefficients. Then, determine the model that fits the data better.

(b) Repeat the fitting using the polyfit method, and verify that you get identical results as

in part (a).

(c) To verify the correctness of your fitted values, plot ν versus T from Eq. (3) using your

best model evaluated at 100 equally-spaced points over the interval 0 ≤ T ≤ 100, and

add the data points {Ti, νi} to the graph, plotted with dots.

(d) Using at most four fprintf commands, print the ci coefficients from the two models as

in the following table:

2

c0 c1 c2

model 1: XXXXXXXXXX

model 2: XXXXXXXXXX0001

Hint: You can use these values to check you got the write coefficients in steps (a)-(c).

Question 3: Write a function which implements Jacobi method and use it to approximate the

solution of the following system of linear equations:

x1 + 15x2 + 5x3 + x5 = 15

20x1 − 2x4 + 4x5 = 25

3x2 + 12x3 + x4 = 11

x1 + x2 + 3x3 + 11x4 + x5 = 38

3x3 + 3x4 + 9x5 = 30

(4)

Continue the iterations until two successive approximations are identical when rounded to three

significant digits. Following the implementation of the direct method for solving linear systems

which uses Gaussian elimination and back substitution, find the exact solution of the system.

Elaborate on the conditions required for the different approaches to be appropriate.

Statement of Assignment:

• Use what you have learned in the module to produce well annotated and structured code

to implement the solutions of the exercises.

• Include short worded discussion for each problem justifying the steps you have taken, as

well as, practical limitations where relevant

• You will be assigned a group and encourage to work together on the different exercises

and the reasoning provided, but everyone should submit an individual report with code

and instructions

• Your submission should include a grade for each of your team members on the scale of

1− 10 reflecting your personal opinion for your teammates contribution.

• Equal marks will be awarded for each of the three questions and 20% of your grade is

reserved for teamwork, programming style and program efficiency

If you are not sure what to do, or if there are any other problems, please contact me by email

me ( XXXXXXXXXX).

END OF SHEET

3

and Programming

AM10NP

Yordan Raykov

Group Assessment

To be handed in on or before May XXXXXXXXXX

In AM10NP, we have learnt the introductory concepts of programming such as: how to read

information from files; how to store it in an array, how to display information, as well as, how

to iterate through data, include conditions and execute basic numeric algorithms which can be

iterative in nature. This assessment provides you with an opportunity to reveal these obtained

skills in addressing real-world challenges common today.

Question 1: Together with the coursework instructions, you will find a file named smartphone.txt:

the file contains raw measurements from an accelerometer placed in a smartphone device. The

data contains 4 columns: column 1 records the times at which measurements are collected,

columns 2, 3 and 4 record the x-axis, y-axis and z-axis of measured acceleration in the device.

• Load the accelerometer data from a file to an arrays ti and ai containing the first axis

and the second-fourth axis of the file. Create a plot of the measured acceleration against

time, i.e. display each column of ai against ti.

• Implement a for loop which passes through each element of the array ti and stores the

difference of two successive elements in array df(i), i.e. df(i) = |ti(i+1) −

ti(i)|. Display a histogram of df.

• Create an array ti un which includes equally spaced values between min(ti) and

max(ti), i.e. uniformly time index. Use the MATLAB function interp1 to interpolate

the arrays ai(:,1), ai(:,2) and ai(:,3) from the known times ti to the desired

times ti un. Display your result by plotting the iterpolated arrays ai interp(:, 1),

ai interp(:,2) and ai interp(:,3) on a single plot.

• For each axis ai interp(:,1), ai interp(:,2) and ai interp(:,3) esti-

mate an unknown piecewise linear trend g from the data which satisfies the following

criteria:

minimize

g∈R

‖ai− g‖22 + λ‖Dg‖22 (1)

where λ is a user-defined hyperparameter and you can use that the matrix D ∈ R(n−2)×n

is known as the second-order difference matrix, defined as:

D =

1 − XXXXXXXXXX . . .

0 1 −2 1 0 0 . . .

0 0 1 −2 1 0 . . .

. . .

. . .

XXXXXXXXXX −2 1

(2)

with n being the length of the array ai and all off-diagonal elements being 0.

• Create an array ai filt = ai − g using the estimated g from above. Display a figure

with the following 3 subplots: subplot(1) plotting the array ai against time in seconds;

subplot(2) plotting the estimated array g against time; subplot(3) plotting the filtered array

ai filt. Save a .txt file which stores the filtered array ai filt.

Question 2: Data on the viscosity of water as a function of temperature are given below,

where T is the temperature in degrees Celsius and ν is the viscosity in mPa·sec:

Ti XXXXXXXXXX XXXXXXXXXX

νi XXXXXXXXXX XXXXXXXXXX 0.32

It is desired to determine which of the following two models is appropriate for the above data:

model 1:v(T ) = exp (c0 + c1T )

model 2:v(T ) = exp

(

c0 + c1T + c2T

2

) (3)

(a) Using the basis-functions method, fit both models to the given data and determine the ci

coefficients. Then, determine the model that fits the data better.

(b) Repeat the fitting using the polyfit method, and verify that you get identical results as

in part (a).

(c) To verify the correctness of your fitted values, plot ν versus T from Eq. (3) using your

best model evaluated at 100 equally-spaced points over the interval 0 ≤ T ≤ 100, and

add the data points {Ti, νi} to the graph, plotted with dots.

(d) Using at most four fprintf commands, print the ci coefficients from the two models as

in the following table:

2

c0 c1 c2

model 1: XXXXXXXXXX

model 2: XXXXXXXXXX0001

Hint: You can use these values to check you got the write coefficients in steps (a)-(c).

Question 3: Write a function which implements Jacobi method and use it to approximate the

solution of the following system of linear equations:

x1 + 15x2 + 5x3 + x5 = 15

20x1 − 2x4 + 4x5 = 25

3x2 + 12x3 + x4 = 11

x1 + x2 + 3x3 + 11x4 + x5 = 38

3x3 + 3x4 + 9x5 = 30

(4)

Continue the iterations until two successive approximations are identical when rounded to three

significant digits. Following the implementation of the direct method for solving linear systems

which uses Gaussian elimination and back substitution, find the exact solution of the system.

Elaborate on the conditions required for the different approaches to be appropriate.

Statement of Assignment:

• Use what you have learned in the module to produce well annotated and structured code

to implement the solutions of the exercises.

• Include short worded discussion for each problem justifying the steps you have taken, as

well as, practical limitations where relevant

• You will be assigned a group and encourage to work together on the different exercises

and the reasoning provided, but everyone should submit an individual report with code

and instructions

• Your submission should include a grade for each of your team members on the scale of

1− 10 reflecting your personal opinion for your teammates contribution.

• Equal marks will be awarded for each of the three questions and 20% of your grade is

reserved for teamwork, programming style and program efficiency

If you are not sure what to do, or if there are any other problems, please contact me by email

me ( XXXXXXXXXX).

END OF SHEET

3

Answered 4 days AfterMay 03, 2021

- slove for the equations and show work need by 1:00 pm todaySolvedOct 19, 2021
- 15. In their 2018 Stanley Cup—clinching game, the Capitals had two more shots on goal than the Golden Knights. Together, they had 64 shots. How many shots did each team have? 17. A 12-oz cup of...SolvedOct 19, 2021
- Grading Sheet Major Assignment 1 Grading Sheet CompetencyRequirements for full credit(optional for student use) Did you meet the requirements?Points possibleYour pointsScoring comments Monthly...Oct 15, 2021
- Given the functionC(x)=(x-6)(x+7)(x-5)" role="presentation" data-asciimath="C(x)=(x-6)(x + 7)(x - 5)" style="display: inline-table; line-height: 0; font-size: 16.992px;...SolvedOct 15, 2021
- This is going to be a math quiz (10 questions). I wantParvesh tohelp me.I hope he will be available tomorrow at 8.30 am.SolvedOct 10, 2021

- // Preconditions: string s, int key</o:p> // Postconditions : encrypted s</o:p> void encryptROT(string& s, int key)</o:p> {</o:p> for (int I = 0; I </o:p> {</o:p>...Oct 20, 2021
- The Future Of Clinical Trials: How AI, Big Tech, & Covid-19 Could Make Drug Development Cheaper, Faster, & More Effective 2021 COVER OPTION 2 The Future Of Clinical Trials: How AI, Big Tech, &...Oct 20, 2021
- Clinical Scenario Analysis · Due 25 Oct by 2000 · Points 100 · Submitting an external tool Students will be required to view the clinical scenario provided and apply the safety and quality matrix (SAC...Oct 20, 2021
- This is to be a reflective commentary of 1000 words (maximum) covering learning from completing the applied engagement portfolio. This assessment is essential to your learning as it gives you the...Oct 20, 2021
- Assignment Details</o:p> Assignment Description</o:p> Watch the following LinkedIn Learning Videos to help you with the assignments in this Unit. </o:p> The CEO and CIO in your...Oct 20, 2021

Copy and Paste Your Assignment Here

Copyright © 2021. All rights reserved.