Use MATLAB's sqrt() instead of .^(0.5).