How to interpolate the data first time they occur
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a large data of two objects moving with certain scenarios and the spacing betwen them is recorded at each 0.02 sec. the spacing values always start with 0 (no idea why, this is from the software and can't control it) then suddenly jump to 400 and reduces gradually to -600. in the range 400 to -600 there are locations where the values are increasing then decreasing again (eg. 0,400.....,285,286,287,288,289,290,291,290,289,288,287.......-600). from this data I'm having two questions. The first is how to let the function interp1 interpolate the spacing variable the first time the value occur (the real data is not interpolated as the example above). Second question is how to neglect the 0 value at the begining and to get the 0 value from the interpolation while going from 400 to -600.
The data is attached and the column of interest is column 13 (letter M in excel). I'm only interested in interpolating the data from -300 spacing to 300 spacing. The below is the code I'm using
TestOut=readmatrix('1.xlsx')
[m1,n1] = size(TestOut);
offset = 1e-11*((1:m1)'*ones(1,n1));
T4 = TestOut+offset;
clear distanceQ speedQ cc
distanceQ = -300:300; % new spacing vector with step size of 1m
for cc=1:width(T4)
speedQ(cc,:)= interp1(T4(:,13),T4(:,cc),distanceQ);
end
%Transpose the data
NewTable = array2table(speedQ.');
2 Commenti
Walter Roberson
il 13 Apr 2021
offset = 1e-11*((1:m1)'*ones(1,n1));
T4 = TestOut+offset;
T4 appears to be time ?
distanceQ = -300:300; % new spacing vector with step size of 1m
speedQ(cc,:)= interp1(T4(:,13),T4(:,cc),distanceQ);
You look like you are interpolating time as the independent variable, but querying at distance ??
Also, you are not skipping column 13 while doing the interpolation ?
Are you trying to figure out the first time that they are at a particular distance?
I do not understand the relationship of the other columns to the column of interest?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!