Formulas for calculating the speed of sound in gases, liquids, and solids is given in: speed.pdf
A Matlab function for these calculations is included in the package given at:
Vibrationdata Matlab Signal Analysis Package
The speed of sound calculator can be accessed within this package under:
Miscellaneous Functions: Acoustics
– Tom Irvine