0% found this document useful (0 votes)
133 views7 pages

A05 Logic and Plots: Instructions

This document provides instructions for an engineering assignment involving logic and plots. It includes 4 problems analyzing billion dollar disasters data, lottery numbers, insulation materials modeling, and parking garage use. For each problem, students are given a specific data file and tasked with using MATLAB to analyze the data, answer questions, and display results. Helpful MATLAB commands and plotting guidelines are provided.

Uploaded by

brinda mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views7 pages

A05 Logic and Plots: Instructions

This document provides instructions for an engineering assignment involving logic and plots. It includes 4 problems analyzing billion dollar disasters data, lottery numbers, insulation materials modeling, and parking garage use. For each problem, students are given a specific data file and tasked with using MATLAB to analyze the data, answer questions, and display results. Helpful MATLAB commands and plotting guidelines are provided.

Uploaded by

brinda mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ENGR 132 Spring 2020

A05 ∙ Logic and Plots


Instructions
1. Read each problem carefully. You are responsible for following all instructions within each problem.
2. Review the grading flowchart for each problem in this assignment. These explain how your work will be
graded.
3. Complete the problems using the problem-specific m-file templates provided in the assignment file. Name
your m-files to match the format in the table below, where login is your Purdue Career Account login.

Item Type Deliverables

Problem 1: Billion Dollar Disasters Individual  A05_disasters_login.m

Problem 2: Lotto Numbers Individual  A05_lotto_login.m

Problem 3: Insulation Materials Modeling Individual  A05_insulation_login.m

Problem 4: Parking Garage Use Individual  A05_parking_login.m

Gradescope Submission Individual  A05_login.pdf

4. Read the submission instructions on the last page of this assignment.

Notes Before You Start

find Command in the MATLAB Editor


If you use the find command and edit your code within the MATLAB editor, you may find that MATLAB produces
a warning on the lines with the find command. MATLAB may suggest that you use logical indexing, which allows
you to use logical 1s and 0s to identify which values in a vector correspond to the ‘true’ condition. You can use
either method, find or logical indexing, on this assignment. You should know how the find command works for
exams.

Helpful MATLAB Commands


Learn about the following built-in MATLAB commands, which might be useful in your solutions:
sum, min, max, mode, mean, find, length, numel, size, rem, sort, close

Creating Plots of Data


• When analyzing bivariate (two variables) data, you must determine which is the independent variable and
which is the dependent variable.

Page 1 of 7
ENGR 132 Spring 2020

• A common way to phrase a request for a plot is to say, “Plot variable 1 versus variable 2.” Variable 1 refers
to the y-axis variable; variable 2 refers to the x-axis variable.
• Be sure to use the proper line and/or marker style for this class.

Creating Plots of Models


• When plotting models, use lines with no data markers. The points used to generate the plot are selected
for convenience and do not refer to actual data.
• You can present a model with its raw data on the same plot. The model is a line with no data markers. The
raw data are data markers and no connecting line.

Testing and Debugging Plot Code


• Always close all figure windows before re-running your code. Otherwise, your code will add or remove
things from the existing plot displays. This can appear randomly in ways that may or may not reflect the
presence of any coding problems.

Page 2 of 7
ENGR 132 Spring 2020

Problem 1: Billion Dollar Disasters

Deliverable
Script: A05_disasters_login.m

Problem
You have a dataset named Data_weather_climate_disasters.csv that contains information about billion-dollar
weather and climate disasters in the US from 1980 – 2018. The National Oceanic and Atmospheric Administration
collected the data and adjusted the disaster costs to 2019 dollars using the 2019 Consumer Price Index to allow for
comparisons. Import the data and use it to answer Parts A and B.
NOTE: Do not hardcode any value unless it is specifically provided in the question text. Do not use any loops or
other non-sequential structures to answer these questions.
Be familiar with the list of commands in the “Notes Before You Start” section to help you solve this problem.

Part A:
Answer questions 1-3 and display the results to the Command Window.
1. Which year had the single most expensive disaster and what was its cost and duration?
2. What is the total number of deaths for all disasters that cost more than $10 billion dollars?
3. What was the highest cost per day for a disaster and when did that disaster begin?
Display Guidelines:
• Print scalar values within an appropriate sentence that answers the question.
• Use appropriate numerical formatting (e.g., control the number of decimal places and do not display in
scientific notation).
• Use 1 print command per question.
• Identify the question number in the text display.

Part B
Find the total number of disasters and their mean cost in
a. the 1980s (i.e., 1980-1989)
b. the 1990s (i.e., 1990-1999)
c. the 2000s (i.e., 2000-2009)
d. the 2010s (i.e., 2010-2018)
Display your results to the Command Window with appropriate numerical formatting and using 1 print command
per decade results.

Publish to PDF for Submission


Publish your script as PDF. You will merge this PDF with the other problems in this assignment.

Page 3 of 7
ENGR 132 Spring 2020

Problem 2: Lotto Numbers

Deliverable
Script: A05_lotto_login.m

Problem
Practice using relational and logical operators with the data file named Data_lotto_numbers.csv. The file contains
all the Mega Millions winning lottery numbers from 5 December 2003 – 29 March 2019. Each row shows the date
and its winning set of numbers. A set of winning numbers contains 6 whole number entries. Numbers 1-5 are
selected from one set of numbers. Number 6 is selected from a second set of numbers.
Import the data file into MATLAB and use it to answer the following questions.
1. How many winning number sets are in the data file?
2. What is the most common winning number for Number 6? How many winning number sets have the most
common number as Number 6?
3. How many times are all six winning numbers even numbers?
4. What date(s) have at least 5 single-digit numbers within the winning number set?
5. On what date(s) are both of these criteria true:
a. The drawing day value appears as Number 6, and
b. The drawing day value also appears within Numbers 1-5?
For example, the winning numbers, in order, were 20, 5, 33, 36, 11, and 11 on Sep 11, 2012. This
entry meets both criteria.
Display your results using professional and easily read format.
NOTE: Do not use any loops or other non-sequential structures to answer these questions.
Be familiar with the list of commands in the “Notes Before You Start” section to help you solve this problem.

Publish to PDF for Submission


Publish your script as PDF. You will merge this PDF with the other problems in this assignment.

Page 4 of 7
ENGR 132 Spring 2020

Problem 3: Insulation Materials Modeling

Deliverable(s)
Script m-file: A05_insulation_login.m

Problem
Engineers model physical systems and examine how those models describe the relationship between variables. In
this problem, you will analyze how two different insulating materials affect energy consumption in houses of
various sizes using both collected data and provided models. You have a file named Data_energy_use.txt, which
contains data collected on the electricity consumption (in kWh/month) for different house sizes (in square feet).
The first column lists house areas and the second and third columns list the power consumptions for houses built
using two different insulating materials (material 1 and 2 respectively).

The models that predict electricity consumption for each of the two materials are
𝑃1 = −1216.144 + 2.399𝐴 − 0.00045𝐴2 1
2
𝑃2 = −1216.144 + 2.4𝐴 − 0.00042𝐴 2
where 𝑃 is the predicted electricity consumption and subscripts 1 and 2 signify material 1 and material 2
respectively, and 𝐴 is the house area.

You must plot the collected data with its corresponding model lines all on the same x-y coordinate axes. To display
smooth model lines for both 𝑃1 and 𝑃2 , calculate vectors the electricity consumptions using a vector of house areas
that ranges from the minimum house size to the maximum house size and contains at least 50 elements.

Plot the collected data and model predictions on the same x-y coordinate axes. Format your plot for technical
presentation.

In the ANALYSIS section of you script, answer the following questions. Use your plot to justify your answers.
1. Using visual inspection, which model best fits its data?
2. How would you describe the relationship between house size and electricity consumption for the range of
data given?
3. Using the model plots, which material do you think reduces energy consumption?

Publish to PDF for Submission


Publish your script as PDF. You will merge this PDF with the other problems in this assignment.

Page 5 of 7
ENGR 132 Spring 2020

Problem 4: Parking Garage Use

Deliverable(s)
Script m-file: A05_parking_login.m

Problem
You have two data files that contain normal parking garage occupancy during business hours for one week. One
file, named Data_garage_market.csv, contains data for a garage near a city market. The other file, named
Data_garage_citycenter.csv, contains data for a garage at the city center.

Part A
Import the data and use it to recreate this figure as Figure 1:

Note: an exact color match is not required, but each data set requires a unique color and that color must match
the corresponding day information in both plots.

Part B
The market garage must close for maintenance from Monday to Friday and the city engineering team would like to
use the city center garage as the alternate parking location. Can the city center garage accommodate the extra
cars?
1. Create a second figure (named Figure 2) to answer the question. Format for technical presentation.
2. In the PART B - ANALYSIS section of your script, write a short paragraph to the city planners with
your answer and reference Figure 2 in your justification.

Publish to PDF for Submission


Publish your script as PDF. You will merge this PDF with the other problems in this assignment.

Page 6 of 7
ENGR 132 Spring 2020

How to Submit Your Work


After you complete the assignment and are ready to submit your work,
1. Merge all the problem PDFs into a single PDF file. Name that file A05_login.pdf.
2. Log into Gradescope and submit A05_login.pdf to the A05 assignment. Indicate which pages correspond to
the proper problems.
Failure to tag the problems appropriately will result in your work receiving zero credit for all wrongly tagged
problems.
3. Log into Blackboard and submit all deliverable files to the A05 Dropbox.
 A05_disasters_login.m
 A05_lotto_login.m
 A05_insulation_login.m
 A05_parking_login.m
 A05_login.pdf
Failure to submit these files to Blackboard may result in 0 for the assignment.
Refer to the activity in A00 in Class 2 if you need help publishing, merging PDFs, or submitting to Gradescope or
Blackboard.

References
NOAA National Centers for Environmental Information (NCEI) U.S. Billion-Dollar Weather and Climate Disasters
(2019). https://www.ncdc.noaa.gov/billions/

https://www.txlottery.org/export/sites/lottery/Games/Mega_Millions/Winning_Numbers/download.html
https://www.statsdirect.com/help/regression_and_correlation/polynomial.htm
Birmingham City Council’s Data Factory, Parking in Birmingham.
https://data.birmingham.gov.uk/dataset/birmingham-parking

Page 7 of 7

You might also like