Receiver function calculation for plane layers in matlab