HW5_Campos_Tyler - 14W-CF 16/2/2011 HW5 Campos, Tyler...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Scholar: HW5 Problem 1 Problem: Create a MATLAB program which will allow the user to input an unknown number of temperature readings, each of which might be a temperature in Celsius, Fahrenheit, Kelvin, or Rankine, and will convert the user input temperature to each of the other temperature scales. The program should request the units of the input temperature from the user, accepting the units as the character ‘C’, ‘F’, ‘K’, or ‘R’. The program must accept only valid temperature units (upper case ‘C’, ‘F’, R’, or ‘K’). The program will store the input and equivalent temperatures in vectors, using one vector for each temperature scale. You may assume the user will always enter a temperature above absolute zero. The program will average the temperatures for each scale, storing the four values in a single vector. Output from the program will be a properly labeled table including: data number (e.g., 1,2,3. .), the temperature in C, F, K and R. In the last row of the table the program will output the average temperature for each scale. Diagram : NA Solution: Flowchart Start Initialize variablescel , Tcel, far, Tfar, kel, Tkel, ran, Tran, n, m, c = 0 cont = ‘y’ While con= ’y’ Input cont? If u=C,F,K,R If u=C If u=F If u=K If u=R Input Temp Input Temp Input Temp Input Temp n=n+1 Cel=temp Fah=((5/9)*temp)+32 Kel=temp+273.15 Ran=((9/5)*temp)+491.69 N=n+1 Fah=temp Cel=(5/9)*(temp-32) Kel=((5/9)*(temp-32))+273.15 Ran=temp+459.69 N=n+1 Kel=temp Cel=temp-273.15 Fah=(9/5)*(temp-273.15)+491.69 Ran=temp+459.69 N=n+1 Ran=temp Cel=(5/9)*(temp-491.69) Far=temp-459.69 Kel=((5/9)*((temp-459.69)-32)+273.15) Conv to vector Celcius Fahrenheit Kelvin Rankine Conv to vector Celcius
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/19/2011 for the course ENGE 1114 taught by Professor Twknott during the Fall '06 term at Virginia Tech.

Page1 / 9

HW5_Campos_Tyler - 14W-CF 16/2/2011 HW5 Campos, Tyler...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online