EGR 103/Fall 2015/Lab 3

From PrattWiki
Jump to navigation Jump to search

Typographical errors

None identified yet!

3.1 Introduction

The main purpose of this lab is to learn how to write programs and how to write functions and scripts that work together. The following is a companion piece to the lab handout itself. The sections in this guide will match those in the handout.

3.2 Resources

See main EGR 103 page for links to these

3.3 Getting Started

Same as it ever was.

3.4 Linking your EGR103 Folder to Gitlab

Do not do this on your own unless you are absolutely sure you know what you are doing! We will all so this together during lab; follow along at EGR 103/GIT.

3.5 Assignment

3.5.1 Chapra 2.11

Info on getting "filled-red" symbols is in Chapra 2.5.

3.5.2 Chapra 2.22

Pretty straightforward. Note that your function will only have three lines of code - the paradigm (the first line at the top of the function that defines the file as a function and names the outputs and inputs) and the two lines that calculate x and y, respectively. The script should to the rest. Putting too much in the function is grounds for losing points. Precious, precious points.

3.5.3 Chapra 3.10

The main concepts here are using logical masks to create piecewise functions, using different sets of points for mathematical analysis versus graphing, and determining and locating extrema.

3.5.4 Palm 4.44

The main concepts here are using the switch-case-otherwise structure when your code is to run certain lines of codes based on strings, using different point styles if you have five or more lines to graph in black and white, put using scripts and functions together.

3.5.5 Weather Data Analysis

The main concepts here are loading and parsing data, determining and locating extrema (using commands such as min, max, and find), printing out combinations of literal characters and formatted matrix values, and excising portions of matrices for use later.

General Concepts

This section is not in the lab report but rather has some items in it that span multiple problems in the lab.

Functions

See Chapra 3.1.2 and Palm 3.2 through page 123

Selective Structures

See MATLAB:Selective Structures, and note especially that if trees will only run if all the logical expression it is given is true. If you want to run when any of them is true, put the any() command with it. Also see Chapra 3.3.1 and Palm 4.4

Determining and Locating Extrema

See MATLAB:Plotting#Using_Different_Scales and MATLAB:Plotting_Surfaces#Finding_Minima_and_Maxima_in_2-D for some examples. Also see Palm Table 2.1-1.

Logical Masks

See MATLAB:Logical Masks.


Class Document Protection