EGR 103/Fall 2017/Lab 3

From PrattWiki
Revision as of 13:27, 13 September 2017 by DukeEgr93 (talk | contribs)
Jump to navigation Jump to search

Typographical errors

  • In 3.4.2, there was a line that said "...grabbing every ninth column and sixteenth row." which should be "grabbing every ninth row and sixteenth column."

3.1 Introduction

This lab involves loading data sets, making graphs and images, and analyzing data sets in terms of averages and extrema.

3.2 Resources

See main EGR 103 page for links to these

3.3 Getting Started

Same as it ever was.

3.4 Assignment

3.4.1 Random Numbers

Note that you have the code for getting a NetID, converting the NetID to a seed for the random number generator, and calculating the number of bins for the histogram. You will need to change the N = 0 line to get input from the user.

help hist

could prove useful here! Note: the hist command should be run without assigning the results to a variable. That is, you will have code similar to

hist(a, b)

and not code similar to

something = hist(a,b)

because the second version will not graph a histogram - it will tell you the bin counts but won't graph them!

Also, you will be using fprintf to print an integer, a strong, and six numbers using scientific notation. See

help fprintf

along with pages 62-63 in Chapra if the class notes are insufficient. Finally, use the commands

rand
randn

to generate your random numbers. The random command is something else entirely.

3.4.2 Hidden Images

Note that you have the code to load, display, title, and save the original array. You also have the code to create a new figure and save a second figure. For that one, you need to fill in the space between starting the figure and saving it. Think about how to extract every 9th row and every 16th column from the original matrix. Once you have done that, apply code that is very similar to that for the original data set. After that, think about how you are going to experiment with different starting points to find the other hidden images (another hint - there are more than two hidden images).

Also - some code is nearly repeated. Learn how to copy and paste in MATLAB by select-dragging the code you want to copy, pointing to where you want the copy, and middle clicking. Later in the course we will look at writing functions to run similar codes, but for now, having some copies will work.

3.4.3 Chapra 2.18-2.19

You can put the code for both graphs in a single script. The commands for starting and saving figures are in the skeleton already. This problem is similar to Cantilever in that you will be producing a graph that has both data points and a model line - the main difference is the model equation is given to you rather than something you would need to find.

3.4.4 Chapra 2.22

The commands for starting and saving the figure are in the skeleton already, as are the commands for breaking the figure into two rows and one column of subplots.

3.4.5 Weather Data Analysis

The commands for starting and saving the figure are in the skeleton already, as are the commands for the diary. There are several things you will have eventually do with this script - just take one little piece at a time and always make sure you have code that works!

General Concepts

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

  • See MATLAB:Diary for more information about diaries. Your will be brought into your lab report with the listinginput command in LaTeX.
  • Use -depsc to print in color, -depsc for black and white.


Class Document Protection