- Double click on the filter block
- Go to initial states
- Fill in the ‘source’ and ‘value’ columns as per requirement.
- Click ‘ok’ and ‘Apply’
Simulation on MPU6050 Accelerometer using simulink block. Why I end up getting the data start from zero for acceleration z-axis when I include the filter?
10 views (last 30 days)
Show older comments
This is my simulink model. I observed that my data when i run the simulation it start from zero. It should start within 9.81 values that describe its gravitational acceleration. If I did not put the filter, the data are shown below the simulink model. While when I applied filter for Z-axis acceleration it turns out like the scope displayed.
0 Comments
Answers (1)
Shreshth
on 8 Jan 2024
Hello Noor,
From the image and question prompt I could see that you are trying to use MPU6050 MEMS sensor to get axial acceleration but when you are applying filter, the initial state of acceleration is changed to zero which instead should be 9.81 m/s² (1g) as per earth’s gravitational pull.
In Simulink you can directly change in initial parameters of the Filter blocks used by changing the preferences settings. Follow the below steps to change the initial value of Z axis acceleration of your model while using the filter block:
You can also check out the image below for reference:
Please keep in mind that the initial conditions should be set based on the expected physical conditions of your system at the start of the simulation. For an accelerometer like the MPU6050, if you're simulating a stationary start, you might set the Z-axis initial condition to 1g (9.81 m/s²) to represent gravity, assuming the positive Z-axis is pointing upwards.
For more information on filters and how to make a desired filter, you can refer to the documentation provided by MathWorks.
Thank you,
Shubham Shreshth.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!