LFD sample code for Matlab