Matlab spike generation