r = 2; % Decimation factor.
hm = mfilt.cicdecim(2,2,4); % Use default NumberOfSections &
% DifferentialDelay property values.
fs = 44.1e3; % Original sampling frequency: 44.1kHz.
n = 0:10239; % 10240 samples, 0.232 second long signal.
t=n/fs;
f=1000;
x = sin(2*pi*f*t);% 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');
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/156199.html
標籤:網絡通信
上一篇:645 串口時間計算問題
下一篇:一臺電腦連接兩個寬帶怎么設定
