Azzera filtri
Azzera filtri

Hi, i have got my results from Xsens but some of the data is laging behind i mean graphs should almost overlap each other. iam attaching the photo if any could help me please

3 visualizzazioni (ultimi 30 giorni)
clear all
close all
clc
% Global variables
sensorsList = ['sensor1';];
nbTrials = 6;
Xtrial = [0,1,2,3,4,5];
nbSensors = 1;
% Initialisation
s = struct();
% Loop
for trial = 1:nbTrials
if Xtrial(trial) < 10
filename1 = strcat('MT_00200231-00',num2str(Xtrial(trial)),'.mtb'); %name of the files to load
else
filename1 = strcat('MT_00200231-0',num2str(Xtrial(trial)),'.mtb');
end
% Loop to load the data of all sensors
for sensor = 1:nbSensors
[sdi,~, DataAcc, DataGyr, DataMag, quat] = mainFileLoader (filename1,sensor); %loader
place = sensorsList(sensor,:);
stemp.dq = [sdi.dq];
stemp.dv = [sdi.dv];
stemp.acc = DataAcc;
stemp.gyr = DataGyr;
stemp.mag = DataMag;
stemp.quat = quat;
s(trial).(place) = stemp;
clear stemp
end
end
clear DataAcc DataGyr DataMag filename1 place quat sdi sensor trial
%To save the structure
save('Data','s');
figure
trial = 1;
sens = 'sensor1';
plot(s(trial).(sens).acc)
figure
for trial = 1:nbTrials
for i = 1:3
subplot(3,1,i)
plot(s(trial).(sens).acc(:,i))
hold on
end
end

Risposte (1)

Neil Guertin
Neil Guertin il 10 Ago 2017
You are only passing one argument to plot, which means that it uses the data given as y values and the indices as x values. It is possible that sensors started at different times and therefore equivalent readings are at different indices.
You may want to get time or duration data along with your sensor readings. If you plot this as the x value, your plots would be aligned so that readings that occurred at the same time are plotted at the same place.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by