What is the . symbol in matlab, how to change it to python
<pre><code>Xnorm = (X-repmat(mu,m,1))./repmat(sigma,m,1);
</code></pre>

<p>what does the . here do? And if I want to change it to the python, what should I do? </p>

<p>In MATLAB you would explicitly replicate elements with that <code>repmat</code> and then do elementwise division with <code>./</code> as also stated in the comments. You could have also used <a href="https://www.mathworks.com/help/matlab/ref/bsxfun.html" rel="nofollow"><code>bsxfun</code></a> for under-the-hood replication aka <code>broadcasting</code> prior to <code>2016B</code> and division in one go, like so -</p>

<pre><code>bsxfun(@rdivide,bsxfun(@minus,X,mu),sigma)
</code></pre>

<p>In this post I am assuming that you are working with NumPy arrays in Python. In NumPy, the <a href="https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html" rel="nofollow"><code>broadcasting</code></a> is done implicitly. MATLAB would have the same starting from <code>2016b</code>. So, we can simply skip the <code>repmat</code> part. Thus, if the input arrays are floating pt ones, you can simply do -</p>

<pre><code>(X-mu)/sigma
</code></pre>

<p>If working with int arrays, I could suggest two ways to achieve the desired output.</p>

<p>One way would be with <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.true_divide.html" rel="nofollow"><code>np.true_divide</code></a> -</p>

<pre><code>np.true_divide((X-mu),sigma)
</code></pre>

<p>Another way would be to convert one of the arrays to floating pt, so that the desired output would be upcasted, like so -</p>

<pre><code>(X-mu)/(sigma).astype(float)
</code></pre>

<p><strong>Sample runs</strong></p>

<p>1) MATLAB :</p>

<pre><code>X =
     1     5     9    13    17
     2     6    10    14    18
     3     7    11    15    19
     4     8    12    16    20
mu =
   101   102   103   104   105
sigma =
   201   202   203   204   205
m =
     4
out =
     -0.49751      -0.4802     -0.46305     -0.44608     -0.42927
     -0.49254     -0.47525     -0.45813     -0.44118     -0.42439
     -0.48756      -0.4703      -0.4532     -0.43627     -0.41951
     -0.48259     -0.46535     -0.44828     -0.43137     -0.41463
</code></pre>

<p>2) NumPy :</p>

<pre><code>In [37]: X
Out[37]: 
array([[ 1,  5,  9, 13, 17],
       [ 2,  6, 10, 14, 18],
       [ 3,  7, 11, 15, 19],
       [ 4,  8, 12, 16, 20]])

In [38]: mu
Out[38]: array([101, 102, 103, 104, 105])

In [39]: sigma
Out[39]: array([201, 202, 203, 204, 205])

In [40]: np.true_divide(X-mu,sigma)
Out[40]: 
array([[-0.49751244, -0.48019802, -0.46305419, -0.44607843, -0.42926829],
       [-0.49253731, -0.47524752, -0.45812808, -0.44117647, -0.42439024],
       [-0.48756219, -0.47029703, -0.45320197, -0.43627451, -0.4195122 ],
       [-0.48258706, -0.46534653, -0.44827586, -0.43137255, -0.41463415]])
</code></pre>

python matlab