post:coarsegraintrackdata.m

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
post:coarsegraintrackdata.m [2022/07/18 23:03] – created pseudomoanerpost:coarsegraintrackdata.m [2022/07/18 23:33] (current) – pseudomoaner
Line 7: Line 7:
 **Author:** Oliver J. Meacock **Author:** Oliver J. Meacock
  
-<code matlab extractTimePoints.m> +<code matlab coarsegrainTrackData.m> 
-function [fieldFlow,fieldPhi] = coarsegrainTrackData(procTracks,fieldSettings,noBinsX,noBinsY)+function [fieldFlow,fieldPhi] = coarsegrainTrackData(procTracks,trackSettings,noBinsX,noBinsY)
 %COARSEGRAINTRACKDATA converts track data into continuum flowfield data by %COARSEGRAINTRACKDATA converts track data into continuum flowfield data by
 %binning up cells and averaging their instantaneous velocities in each bin. %binning up cells and averaging their instantaneous velocities in each bin.
 % %
 %   INPUTS: %   INPUTS:
-%       -procTracks: The track data to be coarsegrained.+%       -procTracks: The track data to be coarsegrained 
 +%       -trackSettings: The settings used to generate the input track data
 %       -noBinsX: The number of bins in the x-direction %       -noBinsX: The number of bins in the x-direction
 %       -noBinsY: The number of bins in the y-direction %       -noBinsY: The number of bins in the y-direction
Line 24: Line 25:
  
 %Bin data from the PTV approach into boxes equivalent to the PIV grid %Bin data from the PTV approach into boxes equivalent to the PIV grid
-xEdges = linspace(0,fieldSettings.fieldWidth,noBinsX+1); +xEdges = linspace(0,trackSettings.maxX,noBinsX+1); 
-yEdges = linspace(0,fieldSettings.fieldHeight,noBinsY+1);+yEdges = linspace(0,trackSettings.maxY,noBinsY+1);
  
-flowBins = cell(noBinsX,noBinsY,fieldSettings.maxF); +flowBins = cell(noBinsX,noBinsY,trackSettings.maxF); 
-oriBins = cell(noBinsX,noBinsY,fieldSettings.maxF);+oriBins = cell(noBinsX,noBinsY,trackSettings.maxF);
  
 %Collate data from all tracks into bin structure %Collate data from all tracks into bin structure
Line 49: Line 50:
 end end
  
-fieldFlow = zeros(noBinsX,noBinsY,fieldSettings.maxF,2); +fieldFlow = zeros(noBinsX,noBinsY,trackSettings.maxF,2); 
-fieldPhi = zeros(noBinsX,noBinsY,fieldSettings.maxF);+fieldPhi = zeros(noBinsX,noBinsY,trackSettings.maxF);
 for i = 1:noBinsX for i = 1:noBinsX
     for j = 1:noBinsY     for j = 1:noBinsY
Line 61: Line 62:
 end end
 </code> </code>
 +
 +**Example usage**
 +<code matlab>
 +%Apply coarsegraining procedure to some input monolayer data
 +[fieldFlow,fieldPhi] = coarsgrainTrackData(procTracks,fieldSettings,40,40)
 +
 +%Visualise results for 100th timepoint using quiver and image representations of flow and orientation data respectively
 +subplot(1,2,1)
 +quiver(fieldFlow(:,:,100,1),fieldFlow(:,:,100,2))
 +axis equal
 +
 +subplot(1,2,2)
 +imagesc(fieldPhi(:,:,100))
 +axis equal
 +colormap('hsv') %HSV is a circular colourmap - appropriate for use with circular data
 +</code>
 +
 +**Example output**
 +{{ :post:coarsegraindemo.jpg?800 |}}
  • post/coarsegraintrackdata.m.1658181820.txt.gz
  • Last modified: 2022/07/18 23:03
  • by pseudomoaner