How to plot trajectories of a project when knowing the acceleration and time
Mostrar comentarios más antiguos
I am currently working on a project which is to plot the trajectory of an accelerometer sensor.
The data gathered from the sensor is in the format of Json. I do not even know how to read that Json file, however, what I do know is that the sensor collects acceleration in x, y, z directions respectively, and the sample rate is 10Hz.
We can simply assume the initial velocity is 0, and the object is positioned at the point (0,0,0) initially.
Respuestas (1)
Pratyush Swain
el 2 de Oct. de 2023
0 votos
Hey Hailong,
I understand you want to read sensor values from json file and then use the sensor's data to calculate trajectories.Please follow the following steps to resolve the task:
1-Please refer to https://www.mathworks.com/matlabcentral/answers/474980-extract-info-from-json-file-by-matlab for reading json file.
2-You can refer to 'cumtrapz' function which computes the approximate cumulative integrals that will help to velocity and then position.For more information please refer to https://www.mathworks.com/help/matlab/ref/cumtrapz.html
3-After obtaining the position values,'plot' function can be leveraged to visualize the trajectory.For more information, please refer to https://www.mathworks.com/help/matlab/ref/plot.html
Hope this helps.
Categorías
Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!