Question
1) Create a 1D array of simulated temperatures (tF) in Fahrenheit for a 1 month period with number of days numDays = 31 according to
1) Create a 1D array of simulated temperatures (tF) in Fahrenheit for a 1 month period with number of days numDays = 31 according to formula:
tF = 75 + 10*sin(nDay*0.4*pi) + 10*rand(1,numDays)
Here nDay is the array of Day numbers (nDay - 1,2,3,...numDays
2) Create a 2nd array (tC) with temperatures converted from Fahrenheit to Celsius according to formula: tC = (tF - 32)*5/9
3) Create a 3rd array (tCSun) with only Sundays temperatures (C) using integer array indexing. Assume that first Sunday falls on nDay = 3
4) Create a 4th array (tCSunHigh) with Sundays temperatures above a threshold tCHigh = 25 C using logical array indexing
5) Print arrays tCSun and tCSunHigh using fprintf function. Temperature values should be printed with one digit after the decimal point. Display value units (C in this case)
Compare the maximum Saturday temperature with the maximum temperature that occurred that month and use an if/else construct to print out the string. 'The highest temperature, [ ouput value] C, occured on a Saturday'
% or % 'The highest temperature, [ouput value] C, did not occur on a Saturday'
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