Q Factor Measurements Using MATLAB