Need help with homework.
This is only my first couple of days using MATLAB. Basically I am trying to make a little temperature conversion program however the displayed answer is always in the form of a 1 x 2 matrix. Any advice is appreciated.
% prompt for user to choose which conversion
chosen_temp = input(‘What is ur chosen conversion, Celsius to Farenheit (1) or Farenheit to Celsius (2): ‘,’s’);
% using that answer to determine which formula is needed and then the
% converted answer
switch chosen_temp
case ‘1’
disp(‘Celsius to Farenheit’)
initial_temp = input(‘Enter the temperature you would like to convert in Celsius:’, ‘s’);
temperature = initial_temp * 9 / 5 + 32
case ‘2’
disp(‘Farenheit to Celsius’)
initial_temp = input(‘Enter the temperature you would like to convert in Farenheit:’, ‘s’);
temperature = (initial_temp – 32) * (5 / 9)
endThis is only my first couple of days using MATLAB. Basically I am trying to make a little temperature conversion program however the displayed answer is always in the form of a 1 x 2 matrix. Any advice is appreciated.
% prompt for user to choose which conversion
chosen_temp = input(‘What is ur chosen conversion, Celsius to Farenheit (1) or Farenheit to Celsius (2): ‘,’s’);
% using that answer to determine which formula is needed and then the
% converted answer
switch chosen_temp
case ‘1’
disp(‘Celsius to Farenheit’)
initial_temp = input(‘Enter the temperature you would like to convert in Celsius:’, ‘s’);
temperature = initial_temp * 9 / 5 + 32
case ‘2’
disp(‘Farenheit to Celsius’)
initial_temp = input(‘Enter the temperature you would like to convert in Farenheit:’, ‘s’);
temperature = (initial_temp – 32) * (5 / 9)
end This is only my first couple of days using MATLAB. Basically I am trying to make a little temperature conversion program however the displayed answer is always in the form of a 1 x 2 matrix. Any advice is appreciated.
% prompt for user to choose which conversion
chosen_temp = input(‘What is ur chosen conversion, Celsius to Farenheit (1) or Farenheit to Celsius (2): ‘,’s’);
% using that answer to determine which formula is needed and then the
% converted answer
switch chosen_temp
case ‘1’
disp(‘Celsius to Farenheit’)
initial_temp = input(‘Enter the temperature you would like to convert in Celsius:’, ‘s’);
temperature = initial_temp * 9 / 5 + 32
case ‘2’
disp(‘Farenheit to Celsius’)
initial_temp = input(‘Enter the temperature you would like to convert in Farenheit:’, ‘s’);
temperature = (initial_temp – 32) * (5 / 9)
end transferred MATLAB Answers — New Questions