Question: Please answer only using Matlab, using any other language (C++, Python) will result in reporting. This entire page is all part of one large problem.


Please answer only using Matlab, using any other language (C++, Python) will result in reporting. This entire page is all part of one large problem. Link to temp_data.mat: https://drive.google.com/file/d/1XaVQgLIUgEk0FoT9gBwSkDsUsTlaLP7_/view?usp=sharing
Note: For this homework you are not allowed to use loop structures. 1. The provided data file contains daily average global temperature from 1800 through 2018. The data are organized as follows: Column 1 2 Value Year (1880 - 2018) Month (1-12) Day of month (1-31) Temp. anomaly (C) 3 4 "Temperature anomaly" just means the difference between the actual temperature and a specified reference level for each day of the year. Load in the data file using the command: load temp_data.mat This will create a matrix called temp_data in the workspace. Use logical array operations, built-in functions, and array indexing in your script to answer the following questions about the data. ROUND CALCULATED TEMPERATURE ANOMALY VALUES TO 3 DECIMAL PLACES C. a. What was the MEDIAN daily temperature anomaly for the years 1880 - 1920? b. What was the MEDIAN daily temperature anomaly for the years 1978 2018? On how many days in 1880 - 1920 was the temperature anomaly negative? d. On how many days in 19782018 was the temperature anomaly negative? e. What was the date (month, day, and year) on which the highest-ever temperature anomaly occurred? f. What is the difference between the highest-ever and lowest-ever temperature anomalies? g. What was the date the last time the temperature anomaly was negative? h. How many days was the temperature anomaly in 2018 greater than the temperature anomaly on the corresponding date in 1958? i. HYPOTHETICAL SCENARIO #1: Some errors occurred during data collection for 1949, so that some of the elements of column 4 of the matrix do not contain valid numerical values. Instead, the value of those elements is NaN - which means, "not a number". Using the function isnan(), replace all of the NaNs with Os. To verify that this worked, calculate sum(isnan (temp_data), 'all'), which should evaluate to 0. HINT: applying isnan() to an array works as in the following example: >>isnan([1 2 3 NaN 4 7 9 NaN 12 18 NaN 4-3]) ans = 1x13 logical array 0001000100100 j. HYPOTHETICAL SCENARIO #2: Suppose a systematic error was discovered in the data collection method, such that the temperature anomaly was overestimated by 0.1 C in the month of August for the year 2000. Create a new matrix identical to the first, except that the 4th column is corrected by subtracting 0.1 from all of the August 2000 data. To verify that this worked correctly, calculate the sum of the temperature anomalies for August 2000 before and after making the correction. The difference should be 3.1. NOTE: If you want to use the Test Bed in MATLAB Grader, store the results in variables called prob2a, prob2b, etc. The checker only tests parts a through f. Submission Requirements Submission location: Carmen Required Files: 1. Main script with comments (.m) 2. A.pdf file with the command window output and any associated plots. This should have: o Parts (a) through (j) of problem 2 Note: For this homework you are not allowed to use loop structures. 1. The provided data file contains daily average global temperature from 1800 through 2018. The data are organized as follows: Column 1 2 Value Year (1880 - 2018) Month (1-12) Day of month (1-31) Temp. anomaly (C) 3 4 "Temperature anomaly" just means the difference between the actual temperature and a specified reference level for each day of the year. Load in the data file using the command: load temp_data.mat This will create a matrix called temp_data in the workspace. Use logical array operations, built-in functions, and array indexing in your script to answer the following questions about the data. ROUND CALCULATED TEMPERATURE ANOMALY VALUES TO 3 DECIMAL PLACES C. a. What was the MEDIAN daily temperature anomaly for the years 1880 - 1920? b. What was the MEDIAN daily temperature anomaly for the years 1978 2018? On how many days in 1880 - 1920 was the temperature anomaly negative? d. On how many days in 19782018 was the temperature anomaly negative? e. What was the date (month, day, and year) on which the highest-ever temperature anomaly occurred? f. What is the difference between the highest-ever and lowest-ever temperature anomalies? g. What was the date the last time the temperature anomaly was negative? h. How many days was the temperature anomaly in 2018 greater than the temperature anomaly on the corresponding date in 1958? i. HYPOTHETICAL SCENARIO #1: Some errors occurred during data collection for 1949, so that some of the elements of column 4 of the matrix do not contain valid numerical values. Instead, the value of those elements is NaN - which means, "not a number". Using the function isnan(), replace all of the NaNs with Os. To verify that this worked, calculate sum(isnan (temp_data), 'all'), which should evaluate to 0. HINT: applying isnan() to an array works as in the following example: >>isnan([1 2 3 NaN 4 7 9 NaN 12 18 NaN 4-3]) ans = 1x13 logical array 0001000100100 j. HYPOTHETICAL SCENARIO #2: Suppose a systematic error was discovered in the data collection method, such that the temperature anomaly was overestimated by 0.1 C in the month of August for the year 2000. Create a new matrix identical to the first, except that the 4th column is corrected by subtracting 0.1 from all of the August 2000 data. To verify that this worked correctly, calculate the sum of the temperature anomalies for August 2000 before and after making the correction. The difference should be 3.1. NOTE: If you want to use the Test Bed in MATLAB Grader, store the results in variables called prob2a, prob2b, etc. The checker only tests parts a through f. Submission Requirements Submission location: Carmen Required Files: 1. Main script with comments (.m) 2. A.pdf file with the command window output and any associated plots. This should have: o Parts (a) through (j) of problem 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
