A05 Logic and Plots: Instructions
A05 Logic and Plots: Instructions
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.
Page 2 of 7
ENGR 132 Spring 2020
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.
Page 3 of 7
ENGR 132 Spring 2020
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.
Page 4 of 7
ENGR 132 Spring 2020
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?
Page 5 of 7
ENGR 132 Spring 2020
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.
Page 6 of 7
ENGR 132 Spring 2020
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