Plot trajectory based on position/acceleration data

조회 수: 10 (최근 30일)
JB105
JB105 2021년 12월 14일
이동: Voss 2022년 8월 19일
I have acceleration data (a_x a_y a_z) and would like to plot the trajectory. After integration, I have the way (s_x s_y s_z) as well as the velocity. Is there an easy way to plot the traveled way based on this data?
Like geoscatter does with lat and long data from a gps. Due to the fact that I do not have waypoints, I struggle to use the trajectory commands.
Thanks!
hold on
%Read Data from Excel file
%Acceleration
[Time_acc a_x a_y a_z] = readvars('auto_accel.xls');
%GPS Data
[Time_gps lat long height ] = readvars('auto_gps.xls');
%Smooth
iN = 20; % Length of filter
glatt_ax = filter(ones(1,iN)/iN, 1, a_x);
glatt_ay = filter(ones(1,iN)/iN, 1, a_y);
glatt_az = filter(ones(1,iN)/iN, 1, a_z);
%Calculate velocity
v_x = cumtrapz(glatt_ax, Time_acc);
v_y = cumtrapz(glatt_ay, Time_acc);
v_z = cumtrapz(glatt_az, Time_acc);
%Calculate Way
s_x = cumtrapz(v_x, Time_acc);
s_y = cumtrapz(v_y, Time_acc);
s_z = cumtrapz(v_z, Time_acc);
figure;
geoscatter(lat, long)
  댓글 수: 1
Cletus Donkor
Cletus Donkor 2022년 8월 18일
이동: Voss 2022년 8월 19일
Hi all, i am currently facing a similar challenge. Is there an existing solution for this?
Thank you.

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

답변 (1개)

Voss
Voss 2021년 12월 14일
How about using plot3?
figure();
plot3(s_x,s_y,s_z);
  댓글 수: 1
JB105
JB105 2021년 12월 14일
이동: Voss 2022년 8월 19일
Thank you, however, this does not give correct results.
If I plot the three path vectors (s_x,s_y,s_z), I do not get a "path" on which I drove with my vehicle.
The correct path would look like this. I know that the data from the accelerometer may not be as perfect as from the GPS, but I think the problem is not there.

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

카테고리

Help CenterFile Exchange에서 Sensor Models에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by