Question: Please I need the code to put in Mathlab. Write a MATLAB function M-file, DetermineState, that receives a temperature in Fahrenheit as input, and returns
Please I need the code to put in Mathlab.
Write a MATLAB function M-file, DetermineState, that receives a temperature in Fahrenheit as input, and returns a number as output that corresponds to its state
return 0 if solid
return 0.5 if in solid-liquid transition
return 1 if liquid
return 1.5 if liquid-gas transition
return 2 if gas
Prevent array input
Examples:
>>DetermineState(200) ans = 1
>>DetermineState(32) ans = 0.5
Script:
function state = DetermineState(temp) %Returns the state of matter for water state = temp; %replace this line with your code to determine the state end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
