a Using a function handle define a MATLAB function that calc

a) Using a function handle, define a MATLAB function that calculates the wind chill temperature according to the following formula:

Twc=35.74+0.6215Ta-35.75V^0.16+0,4275Tav^0.16

where, the actual air temperature Ta and wind speed V are inputs to the function, and the wind chill temperature Twc is the output. For this equation, the units for temperature and wind speed are °F and mph, respectively.

b) Use your function to calculate the wind chill temperature for o 22 F Ta and V 10 mph.

c) Write a script file that does the following operations. Using the MATLAB built-in function plot function, plot Twc (in red colour) for o 32 F Ta and V 0 to 40 mph . On the same graph, plot Twc (in blue colour) for o 10 F Ta and V 0 to 40 mph . Be sure to label your graph properly either by command lines or using the plot toolbox.

d) Repeat part c by using f plot function

Solution

Perform y = wcf(t,v)

y = 35.7 + 0.6*t- 35.7*(v^0.16) + 0.43*t*(v^0.16);

for i= -25:5:55;j= 0:5:55;

    A(i,j) = wcf(t*(i),v*(j));

end

end

Function is to come back a table or matrix of wind chill values victimization temperature and wind speed, then it appears that just perform ought to be outlined as

perform A = wcf(t,v)

Where A is that the table of wind chill values, t is that the temperature vector, and v is that the wind speed vector. this could mean that you just would not onerous code the temperatures and speeds within the code as got done however instead use the 2 vectors as inputs to your wind chill equation. So if

t = -25:5:55;

v = 0:5:50;

Then

A = wcf(t,v);

The trick then is a way to calculate A. perform needn\'t be algorithmic as shown, however the nested loop plan could be a sensible start line there area unit alternative ways in which to alter the calculation victimization element-wise operations, except for currently let\'s keep that method. we might wish to reiterate over every temperature and speed try, therefore allow us to do the subsequent

perform A = wcf(t,v)

the concerns gets the quantity of temperature and speed components

numTemps = length(t);

numSpeeds = length(v);

% size A

A = zeros (numTemps,numSpeeds);

the concerns populate A

for m=1:numTemps

for n=1:numSpeeds

A(m,n) = 35.7 + 0.6*t(m)- 35.7*(v(n)^0.16) + 0.43*t(m)*(v(n)^0.16);

end

end

The on top of code isn\'t all that a lot of totally different from what have got. I replaced the indices with m and n as a result of i and j are accustomed represent the complex quantity and therefore it\'s sensible observe to avoid victimization them as indices for looping.

a) Using a function handle, define a MATLAB function that calculates the wind chill temperature according to the following formula: Twc=35.74+0.6215Ta-35.75V^0.
a) Using a function handle, define a MATLAB function that calculates the wind chill temperature according to the following formula: Twc=35.74+0.6215Ta-35.75V^0.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site