kelvinToAny
PURPOSE
kelvinToAnyany takes input in K, returns temp in C, K, F, or R.
SYNOPSIS
function [ Tout ] = kelvinToAny( K,outDegrees )
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
- tempConvert1 Same function as tempConvert, demonstrating use of functions instead of inline code.
SOURCE CODE
function [ Tout ] = kelvinToAny( K,outDegrees )
global DEBUG
DEBUG=0;
outDegrees=upper(outDegrees);
if DEBUG==1
fprintf('Input temperature was %6.1f\n',K);
fprintf('Units requested are %3s\n',outDegrees);
end
switch outDegrees
case('K')
Tout=K;
case('C')
Tout=K-273;
case('F')
Tout=(9/5)*(K-273)+32;
case('R')
F=(9/5)*(K-273)+32;
Tout=F+459.67;
otherwise
warning(['Invalid output units ',outDegrees])
end
end
Generated on Fri 07-Nov-2008 13:46:59 by m2html © 2005