Question
Write in MATLAB please. The Daily High Temperatures for the month of January 2021 is logged by various local and national agencies. Write a MATLAB
Write in MATLAB please.
The Daily High Temperatures for the month of January 2021 is logged by various local and national agencies. Write a MATLAB script called A5_HW.m that will interface with a user to process various results from the base monthly data that is provided. Detailed specifications will follow below, but the focus will be to use MATLABs matrix manipulation techniques to do most of the heavy lifting.
Our base data is shown below, where each entry corresponds to a daily high temperature, in degrees Fahrenheit, for each day of the week (starting on a Friday), thus there are 31 entries for January: january21 = [ 74 60 54 61 54 57 49 41 37 45 45 38 42 58 55 48 55 56 55 55 55 57 60 65 72 71 60 48 56 60 70]
Your program shall store the monthly data in the form of a 1D vector, with the appropriate data type.
Your program shall NOT print information to the screen except as required herein.
Your one-time output heading and prompt shall be (an example run) :
EGR 150-OX Summer 2021, A5_HW: DAILY TEMPERATURES
Please enter a day in January 2021 to evaluate: 10
The number to the right simulates a user-entered number that is not part of the prompt itself, and which must be in the range 1 31, for January)
Your program shall accept one integer number for processing.
If the user number entered a number outside the range of days for the month, you shall generate an error message, and end the program.
Your program shall include a local function called evaluateDay, that takes the user-defined data input, and returns a string result according to the decision table below:
cold day < 60 degrees; pleasant day, between 60 84 degrees; hot day >= 85 degrees.
Apart for evaluating the users daily high temperature, you shall also generate the following printout on the screen, prior to that final result:
For the month of January, 2021:
The average temperature was x degrees Fahrenheit.
The highest temperature was x degrees Fahrenheit.
The lowest temperature was x degrees Fahrenheit.
For January 21, it was 45 degrees Fahrenheit, a Cold day.
X day(s) had this very same temperature.
Your output should be formatted as in the examples above (given that we had day 10 as input). See the decision table, to see why the output has this value and evaluation.
Note: -You are encouraged to use MATLABs built-in matrix functions.
-Logical arrays can be used to obtain, say that last result.
-The fprintf function is probably the best to get the output results required.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started