lab01 -Assignment - MIE335S Lab 01 Winter 2012 MIE335 Lab 1...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MIE335S Lab 01 Winter 2012 MIE335 Lab 1 : (Re-)Introduction to MATLAB 1 Overview The purpose of this lab is to refamiliarize yourself with MATLAB fundamentals and features. Read the following tutorial 1 and try all the examples. You can make up numbers if necessary. This outline is broken down into two parts: the first half details using MATLAB (Sections 2 , 3 , 4 ), while the second half details how to program in MATLAB (Section 6 ). 1.1 Deliverable Submit a MATLAB m-file that implements the bisect method described in this lab with the modication to return elapsed time. Your file should be named (in lowercase only) lab01 utorid.m . For example, if this is lab 1 and for UTORid of doejohn, name the file lab01 doejohn.m . Submit your file within 5 hours after the end of lab. 2 Introduction MATLAB ( Mat rix lab oratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB is especially designed for matrix computations: solving systems of linear equations, computing eigenvalues and eigenvectors, factoring matrices, and so forth. In addition, it has a variety of graphical capabilities, and can be extended through programs written in its own programming language. Many such programs come with the system; a number of these extend MATLAB’s capabilities to nonlinear problems, such as the solution of initial value problems for ordinary differential equations. MATLAB is designed to solve problems numerically, that is, in finite-precision arithmetic. Therefore it produces approximate rather than exact solutions, and should not be confused with a symbolic computation system (SCS) such as Mathematica or Maple. It should be understood that this does not make MATLAB better or worse than an SCS; it is a tool designed for different tasks and is therefore not directly comparable. 3 Basics 3.1 Entering vectors and matrices; built-in variables and functions The following commands show how to enter numbers, vectors and matrices, and assign them to variables ( >> is the Matlab prompt) 1 Modified from MIE235 and http://www.math.mtu.edu/ msgocken/intro/intro.html 1 MIE335S Lab 01 Winter 2012 >> a = 2 a = 2 >> x = [1;2;3] x = 1 2 3 >> A = [1 2 3;4 5 6;7 8 9] A = 1 2 3 4 5 6 7 8 9 Notice that the rows of a matrix are separated by semicolons, while the entries on a row are separated by spaces (or commas). A useful command is “ whos ”, which displays the names of all defined variables and their types: >> whos Name Size Bytes Class Attributes A 3x3 72 double a 1x1 8 double x 3x1 24 double Note that each of these three variables is an array; the “shape” of the array determines its exact type. The scalar a is a 1 × 1 array, the vector x is a 1 × 3 array, and A is a 3 × 3 array (see the “size” entry for each variable). You can also find this in the workspace window....
View Full Document

This note was uploaded on 03/31/2012 for the course MIE 335 taught by Professor Frances during the Spring '12 term at University of Toronto.

Page1 / 13

lab01 -Assignment - MIE335S Lab 01 Winter 2012 MIE335 Lab 1...

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