Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write in Matlab program. My Solutions> computeMinTemperature The lowest temperature for each month for a year (in Fahrenheit, rounded to the nearest integer) for
Please write in Matlab program.
My Solutions> computeMinTemperature The lowest temperature for each month for a year (in Fahrenheit, rounded to the nearest integer) for different locations are stored in a data file. Each line in the file has a location ID followed by 12 temperatures. For example, the file might store 432 33 37 42 45 53 72 82 79 66 55 46 41 777 29 33 41 46 52 66 77 88 68 55 48 39 567 55 62 68 72 75 79 83 89 85 80 77 65 The value of the first field in each row (432, 777 and 567) is a location ID. The 12 numbers that follow the location ID are the lowest temperatures for the months. Write a function computeMinTemperature that will take the filename as an input argument, compute the minimum temperature for each location, and return two vectors: the first vector must contain the location IDs in the same order they appear in the file; and the second vector must contain the minimum temperature for each location (the same order as the locations) You must use the computeMatrixMin function to find the minimum value(s) of a matrix. You may assume the function is ready for use (provided as part of this question) with the signature: function [row min matrix min] = computeMatrixMin(A) Your function will have the following signature function [loc_id, min_templcomputeMinTemperature(file_name) Inputs: ile name name of the file that contains the data Inputs: file_name name of the file that contains the data Outputs: loc_id - 1xN vector with the location IDs, in the same order they appear in the file, where N is the number of rows in the file 1 if the file does not exist min_temp- 1xN vector that contains the minimum temperature for each location 1 if the file does not exist In the above example, if the file specified was given as the input file_name, the output must be loc-id = 432 777 567 max-int 33 29 55 Code to call your function file_name 'datal.dat'; 2 [loc_id min_temp] - computeMinTemperature(file_name) 1Step 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