We consider first nonlinear systems of the formtogether with a standard quadratic cost functional and replace the system by a sequence of time-varying approximations for which the optimal control problem can be solved explicitly. We then show that the sequence converges. Although it may not converge to a global optimal control of the nonlinear system, we also consider a similar approximation sequence for the equation given by the necessary conditions of the maximum principle and we shall see that the first method gives solutions very close to the optimal solution in many cases. We shall also extend the results to parabolic PDEs which can be written in the above form on some Hilbert space.