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

There are 3 options to establish the path: Check path0 function: Current folder

ID: 3868122 • Letter: T

Question

There are 3 options to establish the path: Check path0 function: Current folder window right-click to your folder add to path: Home ribbon Set Path add your folder. Creating own Matlab function (assessment part #1) a) Your task is to create a simple function to convert temperature in Celsius or Fahrenheit to Kelvin. The function call should look similar to this: [valueOut, 'unitNew'] = TempConvert (valueIn, 'unitOld') If the temperature is below 250 K, the function should display the message: I'm freezeing man, it is only xxx K' (xxx - input temperature) If the temperature is above 500 K, the function should display the message: 'Where is my beer? xxx K is too hot' (xxx-input temperature).

Explanation / Answer

temperature = input('Please enter the temperature: '); units = input('Please enter the units of Temperature to be Converted (F or K): ','s'); if (units == 'F' || units == 'f') converted = temperature*(9/5) + 32; convertedto = 'F'; elseif (units == 'K' || units == 'k') converted = temperature+273.15; convertedto = 'K'; else fprintf(' You have given a wrong input ') fprintf('The program will restart again ') fprintf('----------RESTART - FCF.M --------- ') fcf end fprintf('%.2f = %.2f %s ',temperature,converted,convertedto)