a MATLAB script to compute P(A)