I have a vector field (velocity) and I want to integrate around a rectangle. If I had a function for the field it would be easy and I know how to do it. However, I only have the coordinates. Is there an easy way of doing this?
I thought about how I'm going to solve it, started writing the steps for the solution: parametrise each line, find the derivative of the parametrisation. However, I got stuck because in the integral, the field has to be evaluated at the parametric function.
$\begin{align} \int_C \vec F \cdot d\vec r &= \int_C \vec F \cdot \vec T \: ds \\ &= \int_a^b \vec F\left(\vec r(t)\right) \cdot \frac{\vec r'(t)}{\left\lVert \vec r'(t) \right\rVert} \left\lVert \vec r'(t) \right\rVert \: dt \\ &= \int_a^b \vec F\left(\vec r(t)\right) \cdot \vec r'(t) \: dt \end{align}$
The first part of the last line is where I got stuck, t would be involved and I don't know how to do it numerically.
***** Side note, I'm trying to calculate circulation which can also be found by calculating the surface integral of the curl of velocity (vorticity), but I guess that would be even harder *numerically***
I use MatLab but anything that would get me started would do
Thanks
Edit: The above equation was copied from a website, let me use my own notation:
I have a vector field $\vec V = \vec V(x,y)$ which has an x component $u$ and a y component $v$.
$\Rightarrow \vec V(x,y) = u(x,y) \; \vec i + v(x,y) \; \vec j $
I want to integrate along C which is a rectangle so I will have to divide the integration into 4 parts (4 smooth curves).
The vertices of the rectangle are $(0.0274,0.0386)\: (0.0926,0.0386) \: (0.0926,0.1184) \: (0.0274,0.1184)$
So the four curves are: $\begin{align} C_1: \: \: r_1(t) = t \; \vec i + 0.0386 \; \vec j \hspace{2cm} for\hspace{1cm} 0.0274 \le t \ge 0.0926 \\ C_2: \: \: r_2(t) = 0.0926 \; \vec i + t \; \vec j \hspace{2cm} for\hspace{1cm} 0.0386 \le t \ge 0.1184 \\ -C_3: \: \: r_3(t) = t \; \vec i + 0.1184 \; \vec j \hspace{2cm} for\hspace{1cm} 0.0274 \le t \ge 0.0926 \\ -C_4: \: \: r_4(t) = 0.0274 \; \vec i + t \; \vec j \hspace{2cm} for\hspace{1cm} 0.0386 \le t \ge 0.1184 \end{align}$ and the derivatives: $\begin{align} r_1'(t) &= 1 \; \vec i + 0 \; \vec j \\ r_2'(t) &= 0 \; \vec i + 1 \; \vec j \\ r_3'(t) &= 1 \; \vec i + \; \vec j \\ r_4'(t) &= 0 \; \vec i + 1 \; \vec j \end{align}$ then: $\begin{align} \Gamma = \int_C \vec V(x,y) \cdot d\vec r &= \\ &= \int_{C_1} \vec V(x,y) \cdot d\vec r + \int_{C_2} \vec V(x,y) \cdot d\vec r - \int_{-C_3} \vec V(x,y) \cdot d\vec r - \int_{-C_4} \vec V(x,y) \cdot d\vec r \\ &= \int^{b_1}_{a_1} \vec V(\vec r_1(t)) \cdot r_1'(t) dt + \int^{b_2}_{a_2} \vec V(\vec r_2(t)) \cdot r_2'(t) dt \\ &- \int^{b_3}_{a_3} \vec V(\vec r_3(t)) \cdot r_3'(t) dt -\int^{b_4}_{a_4} \vec V(\vec r_4(t)) \cdot r_4'(t) dt \end{align}$
This is where I got to, I know that $\vec V(\vec r(t)) = \vec V(x(t),y(t))$, here I cannot think of a way of integrating numerically (mainly the $t$ term in $r(t)$ confuses me). $x$ and $y$ are 2-D grids (a 41 by 35 matrix) where the columns in x are equal and the rows in y are equal. x-component $u(x,y)$ is also a 41 by 35 matrix and so is the y-component $v(x,y)$