Writing a set of functions and equations to calculate temperture
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Write a function for which the inputs are temperature (T) and also a character (‘F’ or ‘C’) that shows whether T is given in terms of Celsius (C) or Fahrenheit (F). The output of the function is velocity of the sound in air which is V = 40.02 sqrt(T) where the temperature T in this equation is in terms of Rankine (R). Test your program and give the output result when the user inputs are (30,’C’) and also (70,’F’). Note that R=F+459.67 and F=1.8 C +32. Can some one help me out with this? I know I am going to need two files one with the function with the speed of sound and the other containing the actual work.
0 comentarios
Respuestas (1)
Evan
el 25 de Jun. de 2013
Editada: Evan
el 25 de Jun. de 2013
Some hints:
- Your function is going to have two inputs: a numerical temperature value and a string character that is either 'F' or 'C'.
- Your function should have one output, or the velocity value you calculate.
- You have to convert your temperature to Rankine, but the way you convert will change based on whether your temperature is in C or F. So you'll need a structure that lets you choose between different lines of code based on certain conditions.
- After you've made the right conversion, it's just simple arithmetic, and you already have the function needed [V = 40.02sqrt(T)].
Final hint: you can do this in about six lines of code, all in a single function that you write.
0 comentarios
Ver también
Categorías
Más información sobre Audio and Video Data en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!