CIC抽取----代码:
r = 2; % Decimation factor.
hm = XXXXXXXXcdecim(r); % Use default NumberOfSections &
% DifferentialDelay property values.
fs = 44.1e3; % Original sampling frequency: 44.1kHz.
n = 0:10239; % 10240 samples, 0.232 second long signal.
x = sin(2*pi*1e3/fs*n);% Original signal, sinusoid at 1kHz.
y_fi = filter(hm,x); % 5120 samples, still 0.232 seconds.
% Scale the output to overlay the stem plots.
x = double(x);
y = double(y_fi);
y = y/max(abs(y));
stem(n(1:44)/fs,x(2:45)); hold on; % Plot original signal
% sampled at 44.1kHz.
stem(n(1:22)/(fs/r),y(3:24),'r','filled'); % Plot decimated
% signal (22.05kHz)
% in red.
xlabel('Time (seconds)');ylabel('Signal Value');
r = 2; % Decimation factor.
hm = XXXXXXXXcdecim(r); % Use default NumberOfSections &
% DifferentialDelay property values.
fs = 44.1e3; % Original sampling frequency: 44.1kHz.
n = 0:10239; % 10240 samples, 0.232 second long signal.
x = sin(2*pi*1e3/fs*n);% Original signal, sinusoid at 1kHz.
y_fi = filter(hm,x); % 5120 samples, still 0.232 seconds.
% Scale the output to overlay the stem plots.
x = double(x);
y = double(y_fi);
y = y/max(abs(y));
stem(n(1:44)/fs,x(2:45)); hold on; % Plot original signal
% sampled at 44.1kHz.
stem(n(1:22)/(fs/r),y(3:24),'r','filled'); % Plot decimated
% signal (22.05kHz)
% in red.
xlabel('Time (seconds)');ylabel('Signal Value');
200字以内,仅用于支线交流,主线讨论请采用回复功能。