An iterative learning controller with initial state learning