FiniteDifferenceMethod

# FiniteDifferenceMethod - function...

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

Sheet1 Page 1 function FiniteDifferenceMethod(nnodes) % Simple Matlab program to demonstrated the finite difference % method with the heat transfer example problem used in lecture. % The differential equation for this problem is % d^2T/dx^2 + h(Ta - T) = 0 % with x = 0 to 10, Ta = 20, and boundary conditions % T(0) = 40 and T(10) = 200. % For this approach, there is no need to convert the second order % ODE into two first order ODEs. Instead, we will discretize the % ODE by replacing the derivative terms with central difference % equations: % d^2T/dx^2 = (T(i+1) - 2*T(i) + T(i-1))/deltax^2 % Substituting this approximation into the original ODE produces % (T(i+1) - 2*T(i) + T(i-1))/deltax^2 + h*(Ta - T(i)) = 0 % Collecting like terms of T yields % -T(i-1) + (2+h*deltax^2)*T(i) - T(i+1) = h*deltax^2*Ta % We now discretize the rod into a number of nodes in the x direction % from x = 0 to x = 10 and apply the discretization equation above % to each node. % Note that the first and last node are not used explicitly, since we

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/05/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

### Page1 / 2

FiniteDifferenceMethod - function...

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

View Full Document
Ask a homework question - tutors are online