***IN MATLAB*** 1. Converting from Celsius to Fahrenheit. The temperature T in d
ID: 3593440 • Letter: #
Question
***IN MATLAB***
1. Converting from Celsius to Fahrenheit. The temperature T in degrees Fahrenheit (°F) is equal to the temperature T in degrees Celsius (°C) times 9/5 plus 32
2. First ask the user what temperature they would like to convert AND what the original temperature is AND what they would like to convert it to (Kelvin(1), Celsius(2), or Fahrenheit(3)). Using an If statement decide what equation to use and convert the temperature. Display the following message:
"Your Temperature in _____ is ___"
Hint: in your if statement you will not only need to assign the temperature value, but you may also need to assign a variable to the temperature type as a string (Kelvin, Celsius, Fahrenheit)
3. Find the Maximum of 3 Numbers.
4. Ask the User for 3 separate Arrays. Then find the array with the smallest length.
Explanation / Answer
3.
Celsius To Fahrenheit
disp('Kelvin(1), Celsius(2), or Fahrenheit(3)');
i=input('Enter The Intial Temprature Type');
j=input('Input the original temp');
k=input('Input the type to convert it to');
if(i==1)
if(k==2)
fprintf('The temerature in %s is %d','Celsius',j-273.15);
end
if(k==3)
fprintf('The temerature in %s is %d','Fahrenheit',(j-273.15)*1.8+32);
end
end
if(i==2)
if(k==1)
fprintf('The temerature in %s is %d','Kelvin',j+273.15);
end
if(k==3)
fprintf('The temerature in %s is %d','Fahrenheit',(j)*1.8+32);
end
end
if(i==3)
if(k==1)
fprintf('The temerature in %s is %d','Kelvin',(j-32)*(5/9)+273.15);
end
if(k==2)
fprintf('The temerature in %s is %d','Celsius',(j-32)*(5/9));
end
end
3 Seperate Arrays
a=input("Enter array a");
b=input("Enter array b");
c=input("Enter array c");
mi=min([length(a),length(b),length(c)]);
disp(mi);
Please give this answer a thumbs up and leave a nice comment if you wish.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.