数字信号处理matlab版答案
【篇一:数字信号处理matlab实例】
txt>例1-1 用matlab计算序列{-2  0  1  –1  3}和序列{1  2  0  -1}的离散卷积。
解 matlab程序如下:
a=[-2 0 1 -1 3];
b=[1 2 0 -1];
c=conv(a,b);
m=length(c)-1;
n=0:1:m;
stem(n,c);
xlabel(n); ylabel(幅度);
图1.1给出了卷积结果的图形,求得的结果存放在数组c中为:{-2 5  1  -3}。
例1-2 用matlab计算差分方程  -4  1  31
  当输入序列为
解 matlab程序如下:时的输出结果 。
  脉冲响应。
n=41; a=[0.8 -0.44 0.36 0.22]; b=[1 0.7 -0.45 -0.6]; x=[1 zeros(1,n-1)]; k=0:1:n-1; y=filter(a,b,x); stem(k,y) xlabel(n);ylabel(幅度)  1.2 给出了该差分方程的前41个样点的输出,即该系统的单位  图
  例1-3 用matlab计算例1-2差分方程
所对应的系统函数的dtft。
解 例1-2差分方程所对应的系统函数为:  0.8?0.44z?1?0.36z?2?0.02z?3
h(z)?1?0.7z?1?0.45z?2?0.6z?3
  其dtft为 0.8?0.44e?j??0.36e?j2??0.02e?j3?
)?1?0.7e?j??0.45e?j2??0.6e?j3? h(e
?j?
用matlab计算的程序如下:
  k=256; num=[0.8 -0.44 0.36 0.02]; den=[1 0.7 -0.45 -0.6]; w=0:pi/k:pi; h=freqz(num,den,w); subplot(2,2,1); plot(w/pi,real(h));grid title(实部) xlabel(\omega/\pi);ylabel(幅度) subplot(2,2,2); plot(w/pi,imag(h));grid
title(虚部) xlabel(\omega/\pi);ylabel(amplitude) subplot(2,2,3); plot(w/pi,abs(h));grid title(幅度谱) xlabel(\omega/\pi);ylabel(幅值) subplot(2,2,4); plot(w/pi,angle(h));grid title(相位谱) xlabel(\omega/\pi);ylabel(弧度)
第2章  离散傅里叶变换及其快速算法
例2-1 对连续的单一频率周期信号 按采样频率
长度n分别选n =20和n =16,观察其dft结果的幅度谱。
解 此时离散序列 ,即k=8。用matlab计 采样,截取算并作图,函数fft用于计算离散傅里叶变换dft,程序如下:
  k=8;  n1=[0:1:19];  xa1=sin(2*pi*n1/k);  subplot(2,2,1)  plot(n1,xa1)  xlabel(t/t);ylabel(x(n));  xk1=fft(xa1);xk1=abs(xk1);  subplot(2,2,2)  stem(n1,xk1)  xlabel(k);ylabel(x(k));  n2=[0:1:15];  xa2=sin(2*pi*n2/k);  subplot(2,2,3)  plot(n2,xa2)  xlabel(t/t);ylabel(x(n));  xk2=fft(xa2);xk2=abs(xk2);
subplot(2,2,4)
stem(n2,xk2)
【篇二:数字信号处理matlab实验作业】
t>discrete-time signals and systems
  project 1 illustration of ensemble averaging
  we assume for simplicity the original uncorrupted data is given by
ns?n??2n?0.9?, the matlab program to generate the ensemble average is given in ??
program 2_1, some statements have been deleted, but needed to be added when running the program.
  question:
(1) using program2_1, generate and plot the above data s?n? and the noise d?n? shown in figure 2.6 of page 48 in the textbook
  (2) using program2_1, generate and plot one sample of the noise-corrupted data s?n??di?n? and the ensemble average obtain after 50 measurements shown in figure
2.7 of page 48 in the textbook.
  p2_1.m
  project 2 complex exponential sequence generation
  matlab includes a number of functions that can be used for signal generation. the complete code to generate a length-n complex exponential sequence with an exponent a?jb is given in program 2_2 below.
  question:
(1) using program2_2, generate and plot complex exponential sequence shown in figure 2.17 of page 59 in the textbook.
  (2) modifying program2_2, generate and plot exponential sequences shown in figure
2.18 of page 60 in the textbook.
  (3) modifying program2_2, generate and plot sinusoidal sequences shown in figure
2.16 of page 58 in the textbook.
  p2_2_1.m
type in real exponent = -1/12
type in imaginary exponent = pi/6
type in the gain constant = 1
type in length of sequence = 40
p2_2_2.m
 
type in a = 1.2
type in the gain constant = 0.2
type in length of sequence = 30
【篇三:数字信号处理matlab编程作业】
=txt>姓名:白焱 学号: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 = );
matlab求傅里叶变换 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([-n
1 n2 v(3:end)]);
结果:
x[n]自相关序列
  y[n]自相关序列
  w[n]自相关序列
x[n]与y[n]互相关序列
  x[n]与w[n]互相关序列
m3.1
代码:
rr=input(value of r =);
xita=input(value of xita =);
fem(1)=0;
fem(2)=-2*rr*cos(xita);
fem(3)=rr*rr;
num = [1];
den = fem;
% compute the frequency response
w = 0:pi/(k-1):pi;
h = freqz(num, den, w);
% plot the frequency response
subplot(2,2,1)
plot(w/pi,real(h));grid
title(real part)
xlabel(\omega/\pi); ylabel(amplitude)
subplot(2,2,2)
plot(w/pi,imag(h));grid
title(imaginary part)
xlabel(\omega/\pi); ylabel(amplitude)
subplot(2,2,3)
plot(w/pi,abs(h));grid
title(magnitude spectrum)
xlabel(\omega/\pi); ylabel(magnitude)
subplot(2,2,4)
plot(w/pi,angle(h));grid
title(phase spectrum)
xlabel(\omega/\pi); ylabel(phase, radians)

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。