Trying to extract data between two event time points

6 visualizzazioni (ultimi 30 giorni)
I am trying to extract some data and do a correlation of the data between two event points on a graph. I found the timing of the event markers and was trying to put that into a for loop to extract data between the two time points. Ran into a lot of issues and started over, do not know where to go from there. Any istance or guidance would be appreciated!
jevent=dSpare_data(:,18); % joystick trigger to bbe used to make start/end of perception segments
jroll=dSpare_data(:,19)*-19; % joystick roll, scale +/- 1 for full scale deflection
jpitch=dSpare_data(:,20)*-19; % joystick pitch, scale +/- 1 for full scale deflection
jyaw=dSpare_data(:,21); % joystick yaw, scale +/- 1 for full scale deflection
t = ckas_timestamp-ckas_timestamp(1)+0.1; % time in sec
ckas_pitch=ckas_xyzypr(:,5);
ckas_roll=ckas_xyzypr(:,6);
figure;
plot(t,jroll,t,jpitch,t,jyaw,t,jevent,t,ckas_pitch,t,ckas_roll);
xlabel('Time (in seconds)');
title('Signal vs Time');
legend({'jroll','jpitch','jyaw','jevent','ckas pitch','ckas roll'},'Location','best');
zoom xon;
grid on;
EventM = [t,jevent];
EventTime = EventM(EventM(:,2)==-4, 1);
ET = round(EventTime);
ETF = unique(ET);
CorrData = [t,ckas_pitch,ckas_roll,jpitch,jroll];
for i = 1:length(ETF)-1
ind_start = ETF(i,1);
ind_stop = ETF(i+1,1);
end
PitchCorrelation = corrcoef(jpitch,ckas_pitch);
RollCorrelation = corrcoef(jroll,ckas_roll);
display(PitchCorrelation);
display(RollCorrelation);

Risposte (0)

Categorie

Scopri di più su Data Import and Analysis 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!

Translated by