ENGR Matlab – Introduction to Engineering
Matlab Homework 7
Distribution Date: Thursday Oct 17, 2024,
Due Date: Wednesday Oct 23, 2024, by 11:57 pm.
You must submit your M-file(s) and submit PDF(s). Click on a window and print to pdf. Command window; editior
window. You must show the program code and the program answers.
(Example)
Name and Date:
Mr. Pow R. Generator
Course and Section: ENGR Course # class # ZZZZZ
Problem and Statement: Matlab Homework 10, problem #4 parts C and D – Key information about problem
(use filename system: lastname_Heated_firstinitial.m)
1. Gilat Chapter 6 / Chapter7 #6. Use a single M-file and use mnemonic variable names of 3 characters
or more for the variables to complete the problem.
This is a comparison problem. If, selection, statements are not required but may be used.
Loops are not required but may be used. Do not add any user defined M-files for this problem.
Use fprintf statements to show the answer to each scenario.
Investigate ways that will make the data look the most understandable.
Each scenario must be answered with Matlab doing the work and the program must output the results to
the screen. There will be a lot of data as output from the conditions.
Consider the built in functions mean, sum and find to be used in the program to get the results.
Note: Some examples in the book may have an error concerning greater than and greater than or equal
to. For our homework a value that is higher means it must be greater than the value. .
The US National Oceanic and Atmospheric Administration collects temperature data.
The maximum daily temperature (in degrees Fahrenheit) for New Your City and for Anchorage Alaska
during the month of January (31 days in the month) are given in vector form:
TNY =
[ 31 26 30 33 33 39 41 41 34 33 45 42 36 39 37 45 43 36 41 37 32 32 35 42 38 33 40 37 36 51 50]
TANC =
[ 37 24 28 25 21 28 46 37 36 20 24 31 34 40 43 36 34 41 42 35 38 36 35 33 42 42 37 26 20 25 31]
Write a Matlab program to answer the following:
a) The program must ask the user to input their lastname.
b) The program must ask the user to input their engineering major.
c) Students must check that their initial data, TNY and TANC are correct. Wrong starting data will be
penalized heavily.
d) Calculate the average temperature for the month in each city. Show the averages with 2 decimal places.
Provide a statement to make your answer clear.
e) How many days was the temperature below the average temperature for each city?
Show the quantity with 0 decimal places. Provide a statement to make your answer clear.
f) How many days and which dates in the month was the temperature in Anchorage, Alaska
higher than the temperature in New York City? Show the quantity with 0 decimal places.
Print out the particular day(s) with 0 decimal places.
Provide statements to make the multiple answers clear.
g) How many days and which dates in the month was the temperature the same comparing Anchorage,
Alaska to New York City? Show the quantity with 0 decimal places.
Print out the particular day(s) with 0 decimal places. Provide statements to make the multiple answers
clear.