If & elseif to determine temperature essentially
Hello everyone,
I’m new to matlab and am trying to learn how to write a script that will take an input variable and look for a letter (K, C, F) and do something if it sees one of these 3 letters. The script below is specific to only temperatures in kelvin but I want to make an if else condition that I can use so it will either convert to kelvin and then do the math or not do it at all. The converison for kelvin is K = 273.15 + C & and the conversion of fareinheit to celsius is C=(F-32)*(5/9).
Here is my script
T_C = input(‘The absolute cold temperature is: ‘); %asks user for Absolute Cold Temp
T_H = input(‘The absolute hot temperature is: ‘); %asks user for absolute hot temp
n = 1-T_C/T_H; %calculates Carnot efficieny
fprintf(‘The Carnot efficieny is %.3fn’, n) %displays Carnot efficienyHello everyone,
I’m new to matlab and am trying to learn how to write a script that will take an input variable and look for a letter (K, C, F) and do something if it sees one of these 3 letters. The script below is specific to only temperatures in kelvin but I want to make an if else condition that I can use so it will either convert to kelvin and then do the math or not do it at all. The converison for kelvin is K = 273.15 + C & and the conversion of fareinheit to celsius is C=(F-32)*(5/9).
Here is my script
T_C = input(‘The absolute cold temperature is: ‘); %asks user for Absolute Cold Temp
T_H = input(‘The absolute hot temperature is: ‘); %asks user for absolute hot temp
n = 1-T_C/T_H; %calculates Carnot efficieny
fprintf(‘The Carnot efficieny is %.3fn’, n) %displays Carnot efficieny Hello everyone,
I’m new to matlab and am trying to learn how to write a script that will take an input variable and look for a letter (K, C, F) and do something if it sees one of these 3 letters. The script below is specific to only temperatures in kelvin but I want to make an if else condition that I can use so it will either convert to kelvin and then do the math or not do it at all. The converison for kelvin is K = 273.15 + C & and the conversion of fareinheit to celsius is C=(F-32)*(5/9).
Here is my script
T_C = input(‘The absolute cold temperature is: ‘); %asks user for Absolute Cold Temp
T_H = input(‘The absolute hot temperature is: ‘); %asks user for absolute hot temp
n = 1-T_C/T_H; %calculates Carnot efficieny
fprintf(‘The Carnot efficieny is %.3fn’, n) %displays Carnot efficieny if statement MATLAB Answers — New Questions