Help to formulate a non linear least squares problem

Hi all,

linear least squares problem can be formulated as follows:

finding a and b that best fit a * x (t) + b to y (t), is equivalent to minimizing sum [(a * x (t) + b - y (t)) ^ 2]

I would like to obtain a correct formulation of this problem:

I'm looking for a1-2-3-4, b1-2-3-4 and c1-2-3-4 that minimize the gap between
a1 * n (t) ^ 2 + b1 * n (t) + c1 and p1 (t)
a2 * n (t) ^ 2 + b 2 * n (t) + c2 and p2 (t)
a3 * n (t) ^ 2 + b3 * n (t) + c3 and q (t)
a4 * n (t) ^ 2 + b4 * n (t) + c4 and d (t)

n is known but p1 p2 q and d are not, however, they are linked by the equation:

y(t+2) = (-p2(t+2)+p1(t+2)*p2(t+1)/p1(t+1)-Te*p1(t+2))*(y(t+1)-p2(t+1)*u(t+1)+p1(t+1)*p2(t)*u (t)/p1(t)+p2(t+1)*Te*y(t)/q(t)+p2(t+1)*Te*d(t)/q(t)-p1(t+1)*y(t)/p1(t)-Te*u(t)*p1(t+1))/(-p2(t+1)+p1(t+1)*p2(t)/p1(t)-Te*p1(t+1))+(-p2(t+2)+p1(t+2)*p2(t+1)/p1(t+1)-Te*p1(t+2))*Te*(y(t)+d(t))/q(t)+p2(t+2)*u(t+2)-p1(t+2)*p2(t+1)*u(t+1)/p1(t+1)-p2(t+2)*Te*y(t+1)/q(t+1)-p2(t+2)*Te*d(t+1)/q(t+1)+p1(t+2)*y(t+1)/p1(t+1)+Te*u(t+1)*p1(t+2)

how from thess informations, can we properly formulate the problem of least squares as a minimization problem?

thanks