{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework 5 Solution

# Homework 5 Solution - Lecture 5 MEEN 357 Homework Solution...

This preview shows pages 1–3. Sign up to view the full content.

Lecture 5 MEEN 357 Homework Solution 1 Lecture-05-Homework-Solution-2009.doc RMB 1. Problem 4.19 of the textbook. Solution : You are given a function ( ) 3 2 4 f x x x = + (5.1) and asked to find a) forward first derivative, b) backward first derivative, c) centered first derivative, d) forward second derivative, e) backward second derivative and f) centered second derivative at the points in the interval 2 2 x separated by a step size of .25 h = . You are also asked to graph these results along with the formulas for the exact derivatives that you can obtain analytically from (5.1). The formulas you must use are given in Chapter 4 of the textbook or in the table ( ) i f x ( ) i f x ′′ Forward ( ) ( ) ( ) 1 i i f x f x O h h + + ( ) ( ) ( ) ( ) 2 1 2 2 i i i f x f x f x O h h + + + + Back ( ) ( ) ( ) 1 i i f x f x O h h + ( ) ( ) ( ) ( ) 1 2 2 2 i i i f x f x f x O h h + + Centered ( ) ( ) ( ) 1 1 2 2 i i f x f x O h h + + ( ) ( ) ( ) ( ) 1 1 2 2 2 i i i f x f x f x O h h + + + given in the notes on Lecture 5. Because the entries in the above table involve the terms 1 1 2 , , i i i x x x + + and 2 i x , these formulas tell you immediately that you are going to have to evaluate the given ( ) f x at points in the interval 2.5 2.5 x in order to calculate the second derivatives at the points 2 x = − and 2 x = . This problem can be done by hand, but it is tedious. MATLAB is ideally suited for this kind of problem. The mfile below generates the table of derivatives. Inserted in the mfile are comments designed to help you understand the details. The mfile is long because it generates both tables and the two plots. You could break the problem down into shorter files. In any case, the file is %Problem 4.19 of the textbook clc clear all %Set the given step size h=.25; %Call by the symbol x the values in the interval -2<=x<=2 devided by the %step size h=.25. This symbol is a matrix of size 1x17. It does not %contain the end points in the larger interval -2.5<=x<=2.5. x=[-2:h:2]; %Call by the symbol x_b the values of x required to calculate the backward %first derivative. This matrix is also a 1x17 matrix. It is one step size %back. x_b=[-2.25:h:1.75];

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Lecture 5 MEEN 357 Homework Solution 2 Lecture-05-Homework-Solution-2009.doc RMB %Call by the symbol x_f the values of x required to calculate the forward %first derivative. This matrix is also a 1x17 matrix. It is one step size %forward x_f=[-1.75:h:2.25];
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

Homework 5 Solution - Lecture 5 MEEN 357 Homework Solution...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online