数字信号处理MATLAB编程作业
姓名:白焱学号:2012001020006
M2.2:代码:(以其中一组实例,其他组相同,其他类似情况不在说明)
n1=-10:10;
xn=5*cos(1.5*pi*n+0.75*pi)+4*cos(0.6*pi*n)-sin(0.5*pi*n);
stem(xn);
xlabel('n');
ylabel('xe[n]');
结果:
M2.9代码:
clear;clc;
x = input('Type in the reference sequence = ');
y = input('Type in the second sequence = ');
% Compute the correlation sequence
n1 = length(y)-1; n2 = length(x)-1;
r = conv(x,fliplr(y));
k = (-n1):n2';
stem(k,r);
xlabel('Lag index'); ylabel('Amplitude');
v = axis;
axis([-n1 n2 v(3:end)]);