MATLAB-Sp15

CSE Training Workshops in MATLAB, Spring 2015

All workshops will be held in the EWS computer laboratory, 1001 Mechanical Engineering Laboratory. There is no sign-up for this series—walk-ins are welcome and encouraged!

Introduction to MATLAB

Feb. 2, 1:00 pm

We will conduct a hands-on walkthrough of what MATLAB has to offer as a foundation for later tutorials throughout the semester. We will cover the following topics:

Lesson Materials

Truss image

Truss matrix

Basic Exercises

Skeleton code for computedamrateofflow.m.

Numerical Methods & Differential Equations

Part 1, Feb. 9, 1:00 pm

Part 2, Feb. 11, 1:00 pm

This tutorial focuses on the solution of differential equations and similar systems with MATLAB. The first lesson will focus on data fitting and the finite difference method (matrix equations and loops). The second lesson will explore differential equation solutions, including systems of equations and the PDE Toolbox.

Lesson Materials

Spring Interpolation Data

m = [5 10 20 50 100];                   %mass data (g)
d = [15.5 33.07 53.39 140.24 301.03];   %displacement data (mm) 
g = 9.81;                               %g = 9.81
F = m/1000 *g;                          %compute spring force (N)

Heat Equation by Finite Difference Method

Finite-difference models are used throughout engineering to obtain numerical solutions to differential equations. This particular system models the heat equation

$$ \frac{1}{\alpha} \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2}$$

given an initial condition of $u(x,t=0) = \sin\left(\pi x/L\right)$ and boundary conditions of $u(x=0,t) = 0$ and $u(x=L,t) = 0$.

To approximate a derivative, the most straightforward way is to take the formal definition

$$f'(x) = \frac{f(x+h)-f(x)}{h}$$

and use a small but nonzero step $h$ in your calculation.

Application of this principle to the heat equation leads to a statement of the form

$$ \frac{1}{\alpha} \frac{u^m_i - u^{m-1}i}{\Delta t} = \frac{u^{m-1}{i-1} - 2 u^{m-1}{i} + u^{m-1}{i+1}}{\Delta x^2} $$

or $u^m_i = \frac{\alpha \Delta t}{\Delta x^2}u^{m-1}{i-1} + \left[1 - 2\left(\frac{\alpha \Delta t}{\Delta x^2}\right)\right]u^{m-1}{i} + \frac{\alpha \Delta t}{\Delta x^2}u^{m-1}_{i+1}$.

This clearly yields a way to calculate subsequent time steps point-by-point from the previous time step's data.

Radioactive Decay System of Differential Equations

Erika's scripts from class:

Parallel MATLAB

Feb. 16, 1:00 pm

We will discuss the Parallel Computing Toolbox, which lets you utilize multiple cores and GPUs on your desktop machine.

Introduction to MATLAB (repeat)

Feb. 17, 1:00 pm

Plotting

Feb. 23, 1:00 pm

This lesson introduces the basic features of MATLAB's plotting system, including a list of commonly required functions and their applications in a scientific computing context. We also discuss how to improve the plot such that it can be published professionally.

Image Processing in MATLAB

Part 1, Mar. 2, 1:00 pm

Part 2, Mar. 4, 1:00 pm

These workshops are designed to teach you how images are represented in MATLAB, how color spaces work, and many of the basic and advanced manipulations you can carry out using the Image Processing Toolkit, including basic automatic feature identification.

Lesson Materials

MRI TIF image

About These Workshops

Contributors

Neal Davis, Erika Fotsch, and Rishabh Narang developed these materials. This content is available under a Creative Commons Attribution 4.0 Unported License.

CC-BY-4.0

Contact

If you have any questions about course availability, concepts, or content, please contact Neal Davis, Training Coördinator for Computational Science & Engineering, at davis68 at illinois dot edu.