Example code used in Keenan et al. 2013 Nature: Increase in forest water-use efficiency as atmospheric carbon dioxide concentrations rise
Includes both a R version and a Matlab version (functionally equivalent), and example data from the University of Michigan Biological Station eddy-covariance flux tower: http://ameriflux.lbl.gov/sites/siteinfo/US-UMB
Keenan, T. F. et al. Increase in forest water-use efficiency as atmospheric carbon dioxide concentrations rise. Nature 499, 324–327 (2013).