-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathderivative.m
More file actions
24 lines (20 loc) · 805 Bytes
/
derivative.m
File metadata and controls
24 lines (20 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
% derivative Ocean data velocity
%
% SYNTAX
% derivative_ = derivative(time,position,VX_interpolant,VY_interpolant)
%
% INPUT ARGUMENTS
% time: scalar
% position: [x1;y1;x2;y2;...;xN;yN]
% VX_interpolant: griddedInterpolant for x-component of velocity
% VY_interpolant: griddedInterpolant for y-component of velocity
%
% OUTPUT ARGUMENT
% derivative_: [xVelocity1;yVelocity1;xVelocity2;yVelocity2;...;xVelocityN;yVelocityN]
function derivative_ = derivative(time,position,VX_interpolant,VY_interpolant)
nPosition = numel(position)/2;
derivative_ = nan(nPosition*2,1);
% x-positions
derivative_(1:2:end-1) = VX_interpolant(time*ones(nPosition,1),position(2:2:end),position(1:2:end-1));
% y-positions
derivative_(2:2:end) = VY_interpolant(time*ones(nPosition,1),position(2:2:end),position(1:2:end-1));