Consider the following example:
time = [733774,733774,733775,733775,733775,733776,733776];
depth = [0,10,0,5,10,0,10];
d = [1,1.3,1,2.5,2.5,1,1.2];
data = horzcat(time',depth',d');
dz = 1;
Here I have a number of measurements taken for three separate days. The first day has 2 measurements taken at 2 separate depths, the second day has 3 measurements taken at 3 depths and the third has 2 measurements taken at 2 depths.
I would like to generate a new variable 'newData' which linearly interpolated (interp1) the values in data. However, I would only like to do this if the number of measurements for any given day exceeds 2. So, for the example above this would only apply to 733775. Here I would like to take the depth measurements and increase the vertical resolution e.g.
newDepth = min(depth):dz:max(depth);
But only perform this for the days when the number of measurements exceed 2. The outcome of what I have described should therefore be:
733774 0
733774 10
733775 0
733775 1
733775 2
733775 3
733775 4
733775 5
733775 6
733775 7
733775 8
733775 9
733775 10
733776 0
733776 10
plus the interpolated values from 'data(:,3)'.
What would be the best way of achieving this?
[1 3 1]for a given day? What if they are[1 1 4]? What if they are[1 4 5]? How should the interpolatio look in these cases? - Jonas