One-dimensional Heat Equation


Description

This MATLAB GUI illustrates the use of Fourier series to simulate the diffusion of heat in a domain of finite size. The quantity u evolves according to the heat equation, ut - uxx = 0, and may satisfy Dirichlet, Neumann, or mixed boundary conditions.

The initial condition is expanded onto the Fourier basis associated with the boundary conditions. Only the first 4 modes are shown. Each Fourier mode evolves in time independently from the others. The corresponding Fourier series is the solution to the heat equation with the given boundary and intitial conditions.

How to use the GUI

Choose one type of boundary conditions. An initial condition that satisfies the selected boundary conditions is shown in blue in the top right plot window.

Click on button #1 to identify the Fourier basis associated with the selected boundary conditions. The first 4 modes are listed and plotted in blue, as functions of x.

Click on button #2 to compute the coefficients of the first 4 modes in the Fourier series expansion of the initial condition. Each of these modes is plotted in red as a function of x. Their superposition is shown in red in the top right plot window, and can be compared to the initial condition.

Move the slider to see how each of the 4 modes evolves in time. The corresponding truncated Fourier series is shown in red in the top plot window.

Download

To download the GUI, right click on each of the links below, and save the corresponding files into a directory. Set the MATLAB path to that directory and then type Heat_Equation at the MATLAB prompt.

Type help Heat_Equation at the MATLAB prompt if you need to be reminded of how to use the GUI.

GUI developed by Zhiying Sun, Spring 2007.