How to make a signal have a slower sample rate
Show older comments
Hi, I'm sure this has an easy answer but I'll ask anyway.
I have a signal (in this case vehicle speed) on a sample test with a sample rate of 2ms (the system sample rate). The real system being simulated has a can signal which updates every 40ms, or 20 samples in this case.
How can I alter the signal I have, which changes every sample, to only change every 20 samples?
Thank you!
Accepted Answer
More Answers (1)
Mathieu NOE
on 16 Nov 2020
0 votes
hello
for integer factor downsampling use : decimate
for non integer factor resampling use resample (not needed in your case)
EXAMPLE: Decimate a signal by a factor of four
t = 0:.00025:1; % Time vector
x = sin(2*pi*30*t) + sin(2*pi*60*t);
y = decimate(x,4);
subplot(1,2,1);
stem(x(1:120)), axis([0 120 -2 2]) % Original signal
title('Original Signal')
subplot(1,2,2);
stem(y(1:30)) % Decimated signal
title('Decimated Signal')
3 Comments
João Araújo
on 16 Nov 2020
Mathieu NOE
on 16 Nov 2020
so you mean you would like to pick 1 sample every 20 and hold the value on the 19 next iterations ?
it's like applying a zero hold sampler
João Araújo
on 17 Nov 2020
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!