Clear Filters
Clear Filters

Remove elements from vector to change the sampling rate

1 view (last 30 days)
Hi to all,
I have a vector " imu" with a size of 11497 elements. These elements are samples captured at a very high rate (the total time is 71 seconds so I think the frequency is about 160 Hz). Since I acquired all the other values at 10Hz, the size of all my other vectors is 719.
I would like to remove the oversampled elements from the vector " imu" in order to have only 10 samples per second.
Is there any way to do this? Can you help me, please?
  2 Comments
Gaurav Ahuja
Gaurav Ahuja on 9 Jan 2018
Could you provide more clarification on this:- 1.) do you wish to make an application that would achieve this? 2.) or do you already have "imu" vector and now wish to get the required data?
For the 1st case, you would need to write a custom logic for doing so. If you are using Simulink, you could use rate transition block to achieve something like this.
For 2nd case, write a custom logic to store the 'n'th element into another vector. Refer the following code for a better understanding.
if true
a = magic(4)
b = a(1:16) % this vector is similar to "imu"
c=b(4:4:16) % accepting every 4th elecment.
end
Hope this helps.
marcusbarnet
marcusbarnet on 10 Jan 2018
Thank you, Gaurav! It was the second case and your solution worked fine for me!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!