Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

matlab Code Weather forecast and actual recordings of Temperature and Humidity f

ID: 1766117 • Letter: M

Question

matlab Code

Weather forecast and actual recordings of Temperature and Humidity for the first 10 days of the month are available. Complete the ollowing MATLAB script to show 1. if there is any day that we predicted both temperature and humidity accurately 2. how many days we underestimated the temperature. 3 how many days we overestimated the temperature or underestimated the humidity. 4. on which days our temperature predictions were accurate within 1 deg. clear, clc; T-forecast=[75 79 64 70 71 80 62 69 68 80. H forecast-131 49 71 74 65 50 43 71 72 76 T_recorded 179 79 70 70 67 79 68 63 76 81 H recorded = [40 44 68 77 74 50 58 58 73 62;

Explanation / Answer

MATLAB code is given below.

clc;
close all;
clear all;

T_forecast = [75 79 64 70 71 80 62 69 68 80];
H_forecast = [31 49 71 74 65 50 43 71 72 76];
T_recorded = [79 79 70 70 67 79 68 63 76 81];
H_recorded = [40 44 68 77 74 50 58 58 73 62];
i = 1;j = 0;m = 0;

for k = 1:length(T_forecast)

if (T_forecast(k) == T_recorded(k) && H_forecast(k) == H_recorded(k));
m = m+1;
end

if T_forecast(k) > T_recorded(k)...
|| H_forecast (k)< H_recorded(k);
j = j+1;
end

if abs(T_forecast(k) - T_recorded(k)) <= 1
Days(i) = k;
i = i+1;
end

end
% Quetion 1
Temp_Humidity_Accurate = m

% Question 2
T_UnderEstimated = length(find(T_forecast < T_recorded))
% Numer of days Temparature underestimated

% Question 3
Temp_over_Humi_Under = j
% Number of days the temparature overstimated
% or humidity underestimated

% Question 4
Temp_Accurate_one_degree = Days % # Days on which the

% temparature Predictions are accurate to within 1 degree

Results:


Temp_Humidity_Accurate =

0


T_UnderEstimated =

5


Temp_over_Humi_Under =

7


Temp_Accurate_one_degree =

2 4 6 10