I have a rather large matrix. The data was sampled at 100 Hz. I want to the data to look like it was sampled at 5 Hz
13 views (last 30 days)
Right now the left column is time and it counts .01, .02, .03 etc.
I want to pull out all of the data at 5 hz intervals such as 0, .2, .4 and delete the rest of the rows.
I will answer any question for clarification too
Jürgen on 17 Aug 2012
well If I understand it well you have a vector Sample100 with 100 Hz Samples and you want only the sample @ 5 hz Sample5=Sample100(1:20:end) should do the trick then hope this helps regards,J
Azzi Abdelmalek on 17 Aug 2012
Edited: Azzi Abdelmalek on 17 Aug 2012
fe=100 %sample frequency
te=1/fe %sample time
fd=5 %desired frequency
td=1/fd %desired sample time
Matt Fig on 17 Aug 2012
Here is another example. You say the first column is time, so it is here.
% Original data with columns: [time,signal]
S = [(0:.01:2*pi).' sin(0:.01:2*pi).'];
Sd = S(1:20:end,:); % Downsampled signal.
Dr. Seis on 17 Aug 2012
Edited: Dr. Seis on 17 Aug 2012
Use resample - This is an example of why you may not want to take every Nth amplitude:
Example where a is your input dataset and b is your output dataset:
Fs_in = 100; % samples per second
Fs_out = 5; % samples per second
b = resample(a,Fs_out,Fs_in);