Sie sind auf Seite 1von 2

SCHOOL OF COMPUTER SCIENCE

7077 System Modelling and Simulation Assignment 1 Due at the lecture May 3rd.
The answers to the assignments for this course come in two components a handwritten part with the mathematics, explanations and commentary for what you have done and text les of the Matlab scripts and functions you have written. To submit the assignment you will have to give the lecturer the handwritten documents at the lecture on the due date and submit your Matlab les through a system called Moodle before 10pm on the due date. Both the handwritten work and the Matlab le(s) MUST have your name and student ID as the rst line. There also MUST be a comment in each le you submit saying which question of which assignment this le is for. Your handwritten submission MUST also have the names of all the les you have uploaded through Moodle. Here are the instructions for uploading your Matlab .m les to Moodle for this assignment. (a) Go to the web page at http://forums.cs.adelaide.edu.au/course/view.php?id=349 (b) Enter your university username (e.g. a1234567) and password. (c) You will, if you have not already done so, be invited to enrol (on Moodle) for this course. Go ahead and enrol. (d) After you have enrolled you will see a Weekly Outline page which shows Assignment 1 in the week of 2 May 8 May. Click on the Assignment 1 link and you will see the following dialog box.

(e) Use the dialog box to choose a Matlab le that you want to submit and then click the Upload this le button. (f) Repeat Step (e) until all the les you want to submit have been uploaded. Dont forget to upload all the functions that are used by your scripts. Your Matlab les will be run by the markers so make sure all the necessary les are uploaded. 1. Write a Matlab script to solve the initial value problem y ex y 2y + y = ex (2ex cos x + 5 sin x), y(0) = 0, y (0) = 1, y (0) = 2 on the interval [0, ] using the Runge-Kutta-Felberg method with adaptive steplength control. The steplength should be constrained to lie inside [hmin , hmax ] = [1/100, 1/4] and your program should try to keep the estimated local truncation error smaller in magnitude than = 107 if that is possible. Your program should use the value h = hmin as a starting step-length, plot the numerical solution it has computed, record and plot the history of step-lengths used, record the history of the local truncation relative error estimates, |ej /uj | and plot the vector z where zj = log10 (|ej /uj |), plot the vector w of values of true generalized relative error (the exact solution is y = ex sin x) of the numerical solution, display z and w .

(a) (b) (c) (d) (e) (f)

The exact solution is:


Solution to y(x)+p(x)y(x)+q(x)y(x)+r(x)y(x)=s(x) 0.35

0.3

0.25

0.2

0.15

0.1

0.05

0.05

0.5

1.5

2.5

3.5

2. Let a = 2, b = 4 and = 1.75. Write and run a Matlab script which uses an explicit nite dierence scheme given in lectures to numerically solve the wave equation (2.1) over the interval [0, a] with the initial conditions (2.2) and (a) the boundary conditions (2.3) u(0, t) = t/2, u(a, t) = 0 u(x, 0) = x(2 x), ut (x, 0) = 1, x [0, a] utt = 2 uxx

(b) and then again with the boundary conditions (2.4) u(0, t) = t/2, u(a, t) = sin(4t/).

Use a grid that has 30 steps in the space direction and 120 steps in the time direction. Your submission should include the derivation of your scheme, with particular attention to the boundary conditions, and the plots of the solutions. [Hint: think carefully before proceeding - its not quite as simple as it might look]

Das könnte Ihnen auch gefallen