CIC插值的代码
R = 2; % Interpolation factor.
hm = XXXXXXXXcinterp(R); % Use default NumberOfSections and
% DifferentialDelay property values.
fs = 22.05e3; % Original sample frequency:22.05 kHz.
n = 0:5119; % 5120 samples, .232 second long signal.
x = sin(2*pi*1e3/fs*n); % Original signal, sinusoid at 1 kHz.
y_fi = filter(hm,x); % 5120 samples, still 0.232 seconds.
% Scale the output to overlay stem plots correctly.
x = double(x);
y = double(y_fi);
y = y/max(abs(y));
stem(n(1:22)/fs,x(1:22),'filled'); % Plot original signal sampled
% at 22.05 kHz.
hold on;
stem(n(1:44)/(fs*R),y(4:47),'r'); % Plot interpolated signal
% (44.1 kHz) in red.
xlabel('Time (sec)');ylabel('Signal Value');