In: Electrical Engineering
Part 1. MATLAB Programming The wind chill
factor measures how cold it feels with a given air temperature T
(in degrees Fahrenheit) and wind speed (V, in miles per hour). The
formula is approximately
WCF = 35.7 + 0.6T ? 35.7(V0.16) + 0.43T(V0.16)
a). Write a function that will calculate the wind chill factor
(WCF) given temperature and wind speed. Your function should round
down to the nearest integer.
b). Write a script that will use the function above to create a
table of wind chill factors, similar to the one shown at
https://en.wikipedia.org/wiki/Wind_chill#/media/File:Wind_chill.png.
Wind speed should be down the left and temperature across the
top.
Please show output if possible Thanks
Code For Wind_Chill_Factor.m
%------------------------------------------
function [ Tw ] = Wind_Chill_Factor( Ta,v)
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
Tw = round(35.74 + 0.6215*Ta - 35.75*v^0.16 +
0.4275*Ta*v^0.16);
end
%--------------------------------------------------
Code for main.m
%---------------------------------------------------------
clc;clear;
Ta = input('Enter the Temperature = ');
v = input('\nEnter the Wind Velocity = ');
Tw = Wind_Chill_Factor( Ta,v);
sprintf('Wind Chill Factor Tw = %f',Tw)
%%
v = 5:5:60;
t = flip(-45:5:40);
T = ones(length(v)+1,length(t)+1);
T(1,1) = NaN;
% T(1,j) = t(j-1);
% T(i,1) = v(i-1);
for i = 2:(length(v)+1)
T(i,1) = v(i-1);
for j = 2:(length(t)+1)
T(1,j) = t(j-1);
T(i,j) = Wind_Chill_Factor( t(j-1),v(i-1));
end
end
T
-------------------------------------------------------------
Sample Output:
------------------------------------------------
Enter the Temperature = 50
Enter the Wind Velocity = 20
ans =
Wind Chill Factor Tw = 44
T =
NaN 40 35 30 25 20 15 10 5 0 -5 -10 -15 -20 -25 -30 -35 -40
-45
5 36 31 25 19 13 7 1 -5 -11 -16 -22 -28 -34 -40 -46 -52 -57
-63
10 34 27 21 15 9 3 -4 -10 -16 -22 -28 -35 -41 -47 -53 -59 -66
-72
15 32 25 19 13 6 0 -7 -13 -19 -26 -32 -39 -45 -51 -58 -64 -71
-77
20 30 24 17 11 4 -2 -9 -15 -22 -29 -35 -42 -48 -55 -61 -68 -74
-81
25 29 23 16 9 3 -4 -11 -17 -24 -31 -37 -44 -51 -58 -64 -71 -78
-84
30 28 22 15 8 1 -5 -12 -19 -26 -33 -39 -46 -53 -60 -67 -73 -80
-87
35 28 21 14 7 0 -7 -14 -21 -27 -34 -41 -48 -55 -62 -69 -76 -82
-89
40 27 20 13 6 -1 -8 -15 -22 -29 -36 -43 -50 -57 -64 -71 -78 -84
-91
45 26 19 12 5 -2 -9 -16 -23 -30 -37 -44 -51 -58 -65 -72 -79 -86
-93
50 26 19 12 4 -3 -10 -17 -24 -31 -38 -45 -52 -60 -67 -74 -81 -88
-95
55 25 18 11 4 -3 -11 -18 -25 -32 -39 -46 -54 -61 -68 -75 -82 -89
-97
60 25 17 10 3 -4 -11 -19 -26 -33 -40 -48 -55 -62 -69 -76 -84 -91
-98
>>
----------------------------------------------------------------------------
Dont Forget to Hit Like....