program_10_5.m
来自「自编的一些小波源程序,用MATLAB编的.希望对那些喜欢小波的人有所帮助.去解压」· M 代码 · 共 23 行
M
23 行
% Program 10_5
% Illustration of Decimation Process
%
clf;
N = input('Length of input signal = ');
M = input('Down-sampling factor = ');
f1 = input('Frequency of first sinusoid = ');
f2 = input('Frequency of second sinusoid = ');
n = 0:N-1;
% Generate the input sequence
x = sin(2*pi*f1*n) + sin(2*pi*f2*n);
% Generate the decimated output sequence
y = decimate(x,M,'fir');
% Plot the input and the output sequences
subplot(2,1,1)
stem(n,x(1:N));
title('Input sequence');
xlabel('Time index n');ylabel('Amplitude');
subplot(2,1,2)
m=0:N/M-1;
stem(m,y(1:N/M));
title('Output sequence');
xlabel('Time index n'); ylabel('Amplitude');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?