Question

MATLAB PROGRAMMING question

ENR-125 Midtem Project 03 05/19 Write a function caled WeatherTemp which inputs °F shade-temp data and subtracts F when windC

0 0
Add a comment Improve this question Transcribed image text
Answer #1

File name : calculateTemp.m  

FahrShadeTemp_ip=[34,35,29,31,28,30,32,28,29,33]; %input array of temp in F

windchill_ip=[0];   %TEST 1 - no windchil

res1=WeatherTemp(FahrShadeTemp_ip,windchill_ip);   %function call

disp('celshadetemp (no wind chill)')

disp(round(res1)) % temp in celcius without windchill

windchill_ip=[1]; %TEST 2 - with wind chill

res2=WeatherTemp(FahrShadeTemp_ip,windchill_ip);   %function call

disp('celfeelsliketemp (with wind chill)')

disp(round(res2))    %temp in celcius with windchill

%Function definition

function CelFeelsLikeTemp=WeatherTemp(FahrShadeTemp,windchill)

    if windchill[0]==1;

        f=FahrShadeTemp-7; %subtract 7 from temp

        CelFeelsLikeTemp=(f-32)/1.8; %convert to celcius

    else

        CelFeelsLikeTemp=(FahrShadeTemp-32)/1.8; %convert to celcius

    end

end

OUTPUT:

In the command window type the file name calculateTemp. This will execute the file and display results.

Without rounding off the values to the nearesrt integer:

COMMAND WINDOW >> calculateTemp celshadetemp (no wind chill) -.11n 1.6667-1.6667-9.5556 -בהניכ 0 2.2222 1.6667 0.5556 celfeel

Rounding off the values to the nearest integer:

COMMAND WINDOW >> calculateTemp celshadetemp (no wind chill) 1 221-21 -2-21 celfeelsliketemp (with wind chill) 3 2-4-65 4 6-6

ALL THE BEST :D

Add a comment
Know the answer?
Add Answer to:
ENR-125 Midtem Project 03 05/19 Write a function caled WeatherTemp which inputs °F shade-temp dat...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT