# Estimate parameters from truncated normal sample [duplicate]

I have a question like this, $X \sim N(\mu,\sigma^2)$ with unknown parameters. Now, a sample of size $m$ generated from X, but filter by X < T, i.e., any number larger than T will be ignored and continue until we have $m$ samples.

How to estimate $\mu$ and $\sigma$?

I suppose we could use E-M algorithm? Since this is similar to the case of missing data.

This is what I've come up so far:

$L(\mu,\sigma^2;x_1,..,x_m,x_{m+1},..x_n) = \prod_i^m f(x_i) \prod_{m+1}^n (1-\Phi(T))$
$Log L(\mu,\sigma^2;x_1,..x_m,x_{m+1},..x_n) = \sum_i^m log(f(x_i)) + \sum_{m+1}^n log(1-\Phi(T))$

Then how to take derivative of the Log likelihood with respect to $\mu$ and $\sigma^2$, also $n$ is unknown, need to be estimated here?