{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# copy of poduv.m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# read data and rearrange in columns\n",
    "[r,c,N] = size(u);\t# 4-D is the number of files\n",
    "\n",
    "len = r*c;\n",
    "\n",
    "U = zeros(len*2,N);         # r*c*3 length of the vector\n",
    "\n",
    "% small rearrangement\n",
    "for i = 1:N\n",
    "    U(1:len,i) = reshape(handles.u(:,:,i),len,1);\n",
    "    U(len+1:2*len,i) = reshape(handles.v(:,:,i),len,1);\n",
    "end\n",
    "\n",
    "% Ensemble average of U:\n",
    "%         meanU = mean(U,2);\n",
    "%         Uf = U;\n",
    "% meanU = zeros(len,1);\n",
    "% Fluctuations\n",
    "%        % Uf = U - repmat(meanU,1,N);\n",
    "%         for i = 1:N\n",
    "%             Uf(:,i) = U(:,i) - meanU;\n",
    "%         end\n",
    "\n",
    "Uf = bsxfun(@minus,U,mean(U,2));"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}