Interpolate data in array to match specified length of data in another vector.
Mostrar comentarios más antiguos
I have a matrix (A) of data recorded at 100Hz and another matrix (B) recorded at 2000Hz over the same period of time. The data is synchronised so start and end time points match. How can I upsample the data in matrix A to match the length of the data in matrix B? I understand interp1 is the tool to use but am unsure how to implement this.
I tried something like this, but ended up with NaNs in A_new after the length of A;
Here, A is a 1267 x 3 and B is a 52820 x 1.
for i = 1:3
x1 = 1:1:size(A(:,i))
v1 = (A(:,i))'
xq1 = 1:1:size(B,1) %Define num of points for finer sampling range over x.
A_new(:,i) = (interp1(x1,v1,xq1))'; %Interpolate the function at the query points.
end
Thanks.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Multirate Signal Processing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!