CS计算机代考程序代写 matlab ENGR20005

ENGR20005
Numerical Methods in Engineering
Workshop 10
Part A: MATLAB Livescripts
10.1 The livescript ENGR20005 Workshop10p1.mlx runs through the solution of initial value problems in MATLAB.
(a) Read through the livescript and make sure you understand what each line of code does.
(b) Modify the livescript to solve the the initial value problem
dx = exp x (10.1)
dt with the initial conditions x(0) = 1.
10.2 The
value problems using explicit methods.
livescript ENGR20005 Workshop10p2.mlx runs through the solution of initial (a) Read through the livescript and make sure you understand what each line of code
does.
(b) Modify the livescript to solve Eq. (10.1).
10.3 The livescript ENGR20005 Workshop10p3.mlx runs through stability analysis. Read through the livescript and make sure you understand how to conduct this type of analysis.
1

Part B: Problems
10.4 A simple method of modelling population growth within a community with finite re- sources is to use the logistic equation
dN =rN􏰄1−N􏰅 (10.2) dt K
Here, the term rN denotes the exponential growth that occurs in a community with infinite resources with a growth rate r, and the term 􏰄1 − KN 􏰅 represents the decay once a specific carrying capacity K is exceeded.
(a) Discretise Eq. (10.2) using both the explicit Euler and Taylor’s method of order 2.
(b) Using your answer to (a) write a function that determines the population over time.
(c) Assume that the population is initially N(0) = 10, the growth rate is r = 2, and the carrying capacity is K = 1000. Using your function from (b) determine when the population exceeds N = 500 and N = 900.
10.5 A model for the growth of small perturbations in a fluid is given by the Landau equation τdA =εA−gA3 (10.3)
dt
where A is the amplitude of the perturbation, τ is its typical time scale, ε is a dimen-
sionless parameter, and g < 0 is a negative constant. (a) Discretise Eq. (10.3) using both the explicit Euler and Taylor’s method of order 2. (b) Using your answer to (a), write a MATLAB function that computes the size of the perturbation as a function of time. Assume that τ = g = 1 and the initial condition is A(0) = 0.1. (c) ExperimentalresultsforRayleigh–Bernardconvectionhaveshownthatthesteady- state amplitude A∗ has a power law dependence on ε, A∗ ∝ εβ, where β = 0.50 ± 0.10. Use your function from (b) to see how well the Landau equation predicts β. 2 10.6 Consider the test problem with the initial condition x(0) = 1. dx = −x (10.4) dt (a) Solve Eq. (10.4) analytically and determine the value of x at t = 1. (b) Use the explicit Euler method with a step size of ∆t = 1 to determine the value of x at t = 1. (c) Repeat (b) with step sizes of ∆t = 10−n, n = 1,2,3,4. (d) Plot the error E = |x(1) − xexact(1)| as a function of ∆t on loglog scales and determine the order of convergence. 10.7 For the following differential equations, determine the maximum time-step that can be used for both the explicit Euler and second order Taylor’s method. (a) dx dt (b) dx dt (c) dx dt (d) dx dt (e) dx dt = −10x =−4x+sin(t) =−x2 = −|x3| =−1−exp(x) Verify your estimates by applying the explicit Euler and second order Taylor’s methods with the initial condition x(0) = 1. 3