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:
- Double click on the filter block
- Go to initial states
- Fill in the ‘source’ and ‘value’ columns as per requirement.
- Click ‘ok’ and ‘Apply’
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.