Hello,
I have four different timeseries vectors containing velocity data from four different test runs. Since they were recorded in the field, the time between the startup of the data logger and the initial movement of the vehicle varies.
I am trying to remove this dead space in order to better compare the different runs.
I have tried adding events to the individual timeseries and then using gettsafteratevent(), but that only deletes the dead space and does not adjust the X-axis. I've also tried resampling with a new timevector, but have only had error messages with that.
Here is the image with the 4 different runs, and events placed where the run really begins:
The only other thought I had was to bring the data into arrays, delete the data that I dont need, and then reconvert to time series.
Anyone have any other ideas?
Thanks, Jay

 채택된 답변

Star Strider
Star Strider 2015년 10월 12일

0 개 추천

One possibility (if you have the Signal Processing Toolbox) is to use the findpeaks function on the negative of your data. I’m not certain that would work on all your data, because even though I enlarged the image, I may not have been able to see all the variations in the deadspace area.
If some of your data don’t have any variations in the deadspace region that findpeaks could detect, another option would be to use the find function. Take a section of your data (such as the first half), and then threshold it using min and a range inequality For instance something like:
min_idx = find(y <= 1.01*min(y), 1, 'last');
to find the end of the ‘dead space’ region.
Without having your data to work with, I can’t write specific code, but these would be my initial approaches to programming the deadspace region endpoint.

댓글 수: 4

jrocket567
jrocket567 2015년 10월 12일
Thanks for the suggestions.
I'm more interested in determining how to remove the regions that I would find using the find() or findpeaks() commands.
I've got good numbers on where I want the new data to begin, just struggling on how to remove the dead data and make the new timeseries begin at 0 again.
Use the indices returned by them to define t=0, and use everything in your time and signal data greater than those indices.
Then redefine those times corresponding to the new ‘start’ indices as zero, and subtract the times corresponding to those new t=0 indices from your existing time vectors.
Probably the best way to illustrate that is to illustrate it(!):
t = linspace(10, 25); % Create Arbitrary Time Vector
y = 5 + (t-15).^2; % Create Aribtrary Signal Vector
min_idx = find(y <= 1.01*min(y), 1, 'last');
t_new = t(min_idx:end) - t(min_idx);
y_new = y(min_idx:end);
figure(1)
subplot(2,1,1)
plot(t, y)
title('Original Signal')
grid
subplot(2,1,2)
plot(t_new, y_new)
title('Signal With New Starting Time')
grid
jrocket567
jrocket567 2015년 10월 13일
Thanks. I was hoping to keep it in the timeseries format, but this is probably easier in the long run.
Star Strider
Star Strider 2015년 10월 13일
My pleasure.
You could probably still keep it in timeseries format, just redefine it in terms of the new data. (I haven’t used timeseries objects much, so I have little experience with them, and can’t provide specific recommendations.)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품

태그

질문:

2015년 10월 12일

댓글:

2015년 10월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by