Spike at the start of discrete integration.

3 views (last 30 days)
I have an angular displacement in Yaw at a 100Hz sampling rate. When I try to differentiate it, I get a spIke at the first sample point of velocity and 2 spikes in the first 2 samples of acceleration. I plan on passing this into a low pass filter so I can't ignore these samples either unfortunately. What am I doing wrong that causes the spikes at the start of my differentiated channel?
The Blue line is Velocity and yellow is Acceleration in the attached scope image.
  4 Comments
Paul
Paul on 7 Dec 2023
Zoom in on each scope for the first 0.040 seconds like in the attached JPEG so we can see what's going on with each signal in the time of interest.
Andrew Gilliam
Andrew Gilliam on 7 Dec 2023
Here's the first few samples. The only thing to note is the offset from zero on the displacement data but the dispalcement value doesn't change in this zoom window.

Sign in to comment.

Accepted Answer

Paul
Paul on 8 Dec 2023
Edited: Paul on 8 Dec 2023
In the first Discrete Derivative block that computes the rate, try setting the parameter "Initial condition for previous weighted input K*u/Ts — Initial condition" to Yaw_Data(1)/Ts, where Ts is 0.01 (or whatever is the Sample Time of the signal driving that block). That should smoot things out for the first couple of sample when Yaw_Data is constant. There will still be a transient when the Yaw_Data changes. Hopefully it doesn't change too much from sample to sample. Estimating acceleration from position can be difficult. Instead of a pure differentiator, maybe a high pass filter would be better.
Also, perhaps combining the differentation and the low pass filter into a single filter would be beneficial, unless you need the rate and acceleration signals explicitly for some other reason.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!