Overdetermined system with discrete data. The setup
I have a set of experimental data (subscript 1) which calculates two variables

*

*$u_1(x,y,z)$

*$v_1(x,y,z)$
I can calculate the three spatial gradients for my two variables ($u_1$ and $v_1$): $\frac{\partial u_1}{\partial x}$, $\frac{\partial u_1}{\partial y}$, $\frac{\partial u_1}{\partial z}$, $\frac{\partial v_1}{\partial x}$, $\frac{\partial v_1}{\partial y}$, $\frac{\partial v_1}{\partial z}$
Continuity equation gives me: $\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} + \frac{\partial w}{\partial z} = 0$, and hence:
$\frac{\partial w_1}{\partial z} = -\frac{\partial u_1}{\partial x}-\frac{\partial v_1}{\partial y}$
So I have 2 velocity fields and 7 gradients from experiment 1. I have a second set of data (subscript 2) as follows:


*$u_2(x,y,z)$

*$w_2(x,y,z)$
Which again means I have two velocity fields and seven gradients: $\frac{\partial u_2}{\partial x}$, $\frac{\partial u_2}{\partial y}$, $\frac{\partial u_2}{\partial z}$, $\frac{\partial w_2}{\partial x}$, $\frac{\partial w_2}{\partial y}$, $\frac{\partial w_2}{\partial z}$, and from continuity: $\frac{\partial v_2}{\partial y} = -\frac{\partial u_2}{\partial x}-\frac{\partial w_2}{\partial z}$
Questions

*

*Firstly, the simplified problem - let's consider only the velocity fields, that is: $u_1$, $v_1$, $u_2$, and $w_2$. My objective is to end up with only 3 velocity fields: $u$, $v$, and $w$. Now, $v$ and $w$ are easy, because I only have one input so I can just say $v = v_1$ and $w = w_2$. $u_1$ and $u_2$ are meant to be the same, but, as in any experiment, there are errors, meaning they are not exactly the same, see below figure. Now, the real $u$ would lie somewhere between these two curves. This is easy enough to visualise in a 1d sense, but I have 3d data. So, how do I estimate $u$?

![u1 and u2 as a function of z][1]
This is a comparison of $u_1$ (green) and $u_2$ (red) showing the similarity and difference in the two data sets.



*The second question is an extension. For 5 of the gradient fields, I have two different ways of working out the gradient. So, how do I estimate the gradient fields?
image  [1]: http://i.stack.imgur.com/WCxTa.png
 A: @Katlkund establishes some basic properties needed to understand the problem. What follows is speculation about which type of problem you may encounter.

Approach 1: Modal least squares
In many least squares problems, we start with a sequence of $m$ measurements, for example,
$$
 \left\{ u_{k}, x_{k}, y_{k}, z_{k} \right\}_{k=1}^{m},
$$ 
and a data model like
$$
 u(x,y,z) = a_{000} + a_{100} x + a_{010} y + a_{001} z  
$$
The amplitudes $a$ represent modes.
The linear system is
$$
\begin{align}
 \mathbf{A} a &= u\\
\left[ \begin{array}{cccc}
  1 & x_{1} & y_{1} & z_{1} \\ 
  \vdots & \vdots & \vdots & \vdots \\
  1 & x_{m} & y_{m} & z_{m} \\
\end{array} \right]
%
\left[ \begin{array}{c}
  a_{000} \\ a_{100} \\ a_{010} \\ a_{001}
\end{array} \right]
%
&=
%
\left[ \begin{array}{c}
  u_{1} \\ \vdots \\ u_{m}
\end{array} \right]
%
\end{align}
$$
From this, you have enough to compute a gradient.

Approach 2: Zonal least squares
In this case, the measurements are of the vector field 
$$
f\colon\mathbb{R}^{3}\mapsto\mathbb{R}
$$
Which is the gradient of the scalar function $u$: 
$$
 \nabla u = f(x,y,z)
$$
The sequence of $m$ measurements
$$
 \left\{ f_{x_{k}}, f_{y_{k}}, f_{z_{k}} \right\}_{k=1}^{m},
$$
Is used to predict $m-1$ values of the potential $u$ in each dimension.
The method relies on the the fact that the average of the gradient is given exactly by the difference between the field values at the boundaries. Let the domain $\omega = \left\{x: a \le x \le b \right\}$, the average of the gradient over the domain is
$$
 \langle \nabla u \rangle_{\omega} = u(b) - u(a)
$$
Consider a device with $2$ zones. The domain is partitioned into $2$ parts.
$$
\begin{align}
 \mathbf{A} u &= f\\
%
\left[ \begin{array}{crc}
  -1 & 1 & 0 \\ 
  0 & -1 & 1 \\
\end{array} \right]
%
\left[ \begin{array}{c}
  u_{0} \\ u_{1} \\ u_{2}
\end{array} \right]
%
&=
%
\left[ \begin{array}{c}
  f_{1} \\ f_{2}
\end{array} \right]
%
\end{align}
$$
