How can I resample my [t x]
matrix and fill the gap of resampled data with interpolation data in Matlab?
Input is the upper signal output is lower signal in the image.The output should be [tout xout]
with similar dimensions to [t x]
. The middle points of resampled data should be interpolated.
Here is a visualisation of my desired output:
t = [0.2 0.25 0.3 0.35 0.4 0.45 0.5] % Original Time Vector
x = [1 2 2.5 2.4 3 2 1] % Original Data Vector
L = length(t);
tv = linspace(min(t), max(t), L); % Time Vector For Interpolation
dv = interp1(t, x, tv, 'linear'); % Interpolated Data Vector
Ts = mean(diff(tv));