How to reduce the sample rate of a over sampled signal? (How to connect data to lines and sample?)
4 views (last 30 days)
Show older comments
Minghao Dong
on 10 Aug 2019
Commented: Star Strider
on 11 Aug 2019
Hi Team,
I have a set of date, for example, sampled at 491.52-MHz. However, I want them to be sampled at 300-MHz using matlab processing. I am thinking I should use the original 491.52-MHz sampled data to reconstruct the original signal and then sample the new reconstructed signal with 300-MHz sample rate. Can anyone help me how to achieve it
The 491.52-MHz data is in attachment.
0 Comments
Accepted Answer
Star Strider
on 10 Aug 2019
Working with your Excel file was something of an adventure!
I assume ‘n’ are nanoseconds and ‘u’ are microseconds. The plot works correctly with those assumptions.
Try this:
[D,S] = xlsread('1.csv');
t = cellfun(@(x)sscanf(x, '%f'), S(3:end,3), 'Uni',0); % Recover Time Vector
nu = regexp(S(:,3), '[un]', 'match'); % Recover ‘n’ & ‘u’
nv = strcmp([nu{:}],'n'); % Logical Vector: ‘n’
uv = strcmp([nu{:}],'u'); % Logical Vector: ‘u’
mult = [[0, nv(nv)]*1E-9, uv(uv)*1E-6]; % Create Multiplier Vector From ‘n’ and ‘u’
t = cell2mat([D(1,1); t]); % Concatenate With Initial ‘t’
tv = t .* mult(:); % Reconstruct ‘t’ With Multipliers
s = D(:,2); % Signal Vector
ts = sortrows([tv, s]); % Reconstructed Time & Waveform Matrix
% Ts = mean(diff(ts(:,1))), Tsd = std(diff(ts(:,1))), Fs = 1/Ts % Original Values
Fs = 300E+6; % Desired Resampling Frequency: 300MHz
[sr, tr] = resample(ts(:,2), ts(:,1), Fs); % Resample Using Original ‘t’ & ‘s’
figure
plot(ts(:,1), ts(:,2))
grid
title('Original Signal')
figure
plot(tr, sr)
grid
title('Resampled Signal')
That should give you the resultl you want.
2 Comments
More Answers (0)
See Also
Categories
Find more on Measurements and Feature Extraction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!