pattern recognition,matlab code