Homework 5 Solution

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

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

View Full Document Right Arrow Icon
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 24 fx 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 22 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 ii fx Oh h + + ( ) ( )( ) 21 2 2 i h ++ + Back ( ) 1 h + ( ) ( )() 12 2 2 ii i h −− + Centered ( ) 11 2 2 h +− + ( ) ( ) 2 2 2 i h + given in the notes on Lecture 5. Because the entries in the above table involve the terms 112 ,, iii x xx +−+ 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];
Background image of page 1

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

View Full DocumentRight Arrow Icon
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]; %Call by the symbol x_2b the values of x required to calculate the backward %second derivative. This matrix is also a 1x17 matrix. It is two step
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online