数字信号处理_MATLAB程序文件

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

例题3.1.1
Fm=10;Fc=100;Fs=500;
k=0:199;
t=k/Fs;
x=si n(2*pi*Fm*t);
y=x.*cos(2*pi*Fc*t);
Y=fft(y,256);
subplot(2,1,1);plot(y);
subplot(2,1,2);plot([-128:127],fftshift(abs(Y)));
实验所得的图像如下图所示:
实验内容1.实现抑制载波的幅度调制。

已调信号y(t)二x(t)cosC c t),式中x(t)为调制信号;
cos(衣)为载波信号。

此处可取x(t) =cos( m二t), c =80二rad /s,^^10_:
rad / s。

(1)分析调制信号x(t)的频谱,绘出其时域波形和频谱。

Matlab程序如下:
Fs=1000;
Fc=40;
N=1000;
wc=80*pi;
n=0:N-2;
t=n/Fs;
x=cos(10*pi*pi*t);
y=x.*cos(wc*t);
z仁fft(x,256);
subplot(2,1,1);plot(t,x);legend('x(t) 的时域波形');
subplot(2,1,2);plot([-128:127],fftshift(abs(z1)));lege nd('x(t) ');
的频谱实验所得图形如下:
Matlab 程序如下:
Fs=1000;
Fc=40;
N=1000;
n=0:N-2;
t=n/Fs;
x=cos(10*pi*pi*t);
y=modulate(x,Fc,Fs,'am');
z=fft(y,256);
subplot(2,1,1);plot(t,y);legend('y(t) 的时域波形');
subplot(2,1,2);plot([-128:127],fftshift(abs(z)));lege nd('y(t)
形')
(2)分析已调信号y(t)的频谱,绘出其时域波形和频谱。

的频域波
丫们的频域波形
(3)设计低通滤波器并应用filter 函数,实现信号同步解调
设计的低通滤波器为chebyl 型低通滤波器,技术参数为:
wp=0.2*pi,ws=0.6*pi,Ap=1Db,As=25dB
调制:
[N,wc]=cheb1ord(0.2*pi,0.6*pi,1,25,
' s ');
[num,den]=cheby1(N,1,wc, ' s ');
[b,a]=bili near(nu m,de n, 0.5);
x=cos(10*pi*pi*t);
y=x.*cos(80*pi*t);
w1=filter(b,a,y);
plot(w1);
Y=fft(w1);
plot(w1);axis([0 500 -1 1]);
5 o o
5 o -2 o.
o.
解调:
[N,wc]=cheb1ord(0.2*pi,0.6*pi,1,25,'s'); [nu m,de n]=cheby1(N,1,wc,'s'); [b,a]=bili near(nu m,de n, 0.5); x=cos(10*pi*pi*t);
y=x.*cos(80*pi*t);
w1=filter(b,a,y);
plot(w1);
Y=fft(w1);
Q=demod(Y,Fc,Fs,'am'); plot(t,Q);
axis([0.3 0.5 -0.1 0.1]);
2.实现含有载波的幅度调制。

已调信号y(t) =[A • mx(t)]cos(「c t),选取A=1,m=0.5,观察调制结果,与抑制载波的幅度调制有什么不同?Matlab 程序:
Fm=10;Fc=100;Fs=1000;N=1000;
k=0:N-1;
t=k/Fs;
x=si n( 2*pi*Fm*t);
subplot(3,1,1);
plot(t,x);
xlabel('t(s)'); title('Modulate sig nal'); y=modulate(x,Fc,Fs,'am'); subplot(3,1,2);
plot(t,y);
xlabel('t(s)');
title('Modulateed sig nal(AM)'); y1=(1+0.5*x).*si n(1OO*pi*t); subplot(3,1,3);
plot(t,y1);
xlabel('t(s)');
title('Modulateed sig nal');
两种调制结果如下:
Modulateed signal (AM)
(3)实现含有载波的幅度调制y(t)二[A • mx(t)]cos(「c t),调制信号为
(1)分析调制信号x(t)的频谱,绘出其时域波形和频谱。

(2)分析已调信号y(t)的频谱,绘出其时域波形和频谱。

①Matlab 程序为:
Fs=1000;
Fc=40;
N=1000;
wc=80*pi;
n=0:N-2;
t=0.5/4:0.001:1.5/4;
x=t;
z 仁 fft(x,256);subplot(4,1,1);plot(t,x);
grid on;legend('x(t)= t 的时域波形'); subplot(4,1,2);plot([-
128:127],fftshift(abs(z1)));
grid on;legend('x(t)= t 时的频谱');
y=(1+0.8*x).*cos(100*pi*t);
z=fft(y,256);
subplot(4,1,3);plot(t,y);
grid on;legend('y(t) 的时域波形');
3t 0 c x(t)二 t -t o 设 t o = 5s , 汁4 4 % E Yt 7色_ 4 X 载波为 cos( c t) = cos(100二t),取 A=1,m=0.8。

3t o 4 4
subplot(4,1,4);plot([-128:127],fftshift(abs (z)));
grid on;legend('y(t) 的频域波形');
实验图形如下图所示:
0.1S 0.2 Q.25 0.3 0.35 0.4 0.45
1 1
1 1
1 1
1' 1
1
1
1
1
| x(t)-t时的频谱MM f 1
②Matlab程序为:
Fs=1OOO;
Fc=40;
N=1000;
wc=80*pi;
n=0:N-2;
0.4
4
5
5
.
1 1
1 1
1 1
1 1
in
i
I;
j I
i1
--- 呦山频域泯形1
1' 1
1 1
1 1
i
I
I
" --j
1 1
1 1L
i r n
5
o
o
x(t)= t的时域波形
-150 ^100 -50 0 50 100 150 2, ------------------ 1 ---------------- 」艸)的时域減形|---------- . ------- r--------
5
o
o
5
t=0.5/4:0.001:1.5/4;
t0=0.5;
x=-t+t0/4;
z仁fft(x,256);subplot(4,1,1);plot(t,x);
grid on;legend('x(t)= -t+t0/4 的时域波形'); subplot(4,1,2);plot([-128:127],fftshift(abs(z1))); grid on;legend('x(t)= -t+t0/4 时的频谱'); y=(1+0.8*x).*cos(100*pi*t);
z=fft(y,256);
subplot(4,1,3);plot(t,y);
grid on;legend('y(t) 的时域波形');
subplot(4,1,4);plot([-128:127],fftshift(abs (z))); grid on;legend('y(t) 的频域波形');
实验图形如下图所示:
-0.4
0.1 40
02
0.15 0.2
0.35 0.45
x(t)- MOM 的时域波形
]
_____ __ L _ ________ _______ J
_ ___ _______ _
;一
1
I 1 i i
b
0.3
0.25 i i n t
V
1
1
|i
1
___ i ___ i __ L_J 1 1
x(t)- -t+tO/4B 寸的频谙
_________ J ____________________________ b _________________ ______
一丨 i x
-100 50 100 150
100 —

50
-150
20
150
y(tj 的时域浪形
0 15 0 2 0 25 04 0 45
丫⑴的频域波形
-100 -50 50 100 150
'I 1
0 35 ③Matlab 程序为: Fs=1000; Fc=40; N=1000; wc=80*pi; n=0:N-2;
t=0.5/4:0.001:1.5/4;
t0=0.5;
x=t-t0;
z仁fft(x,256);
subplot(4,1,1);plot(t,x);
grid on;legend('x(t)=t-t0 的时域波形'); subplot(4,1,2);plot([-128:127],fftshift(abs(z1))); grid on;legend('x(t)=t-t0 时的频谱');
y=(1+0.8*x).*cos(100*pi*t);
z=fft(y,256);
subplot(4,1,3);plot(t,y);
grid on;legend('y(t) 的时域波形');
subplot(4,1,4);plot([-128:127],fftshift(abs (z))); grid on;legend('y(t) 的频域波形');
实验图形如下图所示:
(3)若传输中有噪声加入。

生成噪声信号0.1* randn(1,N),叠加在已调信号y(t) 上,观察其时域波形和频谱。

wc=80*pi;
t=0.5/4:0.001:1.5/4; N=le ngth(t); x1=t;
y1=(1+0.8*x1).*cos(100*pi*t)+0.1*ra ndn (1,N); z 仁 fft(y1,256);
0 45
100
-15G
1
0.1
50 100 y(t)的时域坡形
II >1 4 d
d
■i
I
i| i| 4 1 li
li
1 1 i i I I i
--------------- y (t
崗频域波形
1 i
丨丨1
l
V
1 1 i i 1 1 1
0 15
0.2 0 25 03 0 35 04 x(t)二t*tD 时的频

50
150
1
0.2
0.3
0.35 Q45
100
50
0 50
100 150
0.15
Q.4
subplot(3,2,1);plot(t,y1);
grid on; legend('x(t)= t 的时域波形'); subplot(3,2,2);plot([-128:127],fftshift(abs(z1))); grid on; legend('x(t)= t 的频域波形');
x2二t+tO/4;
y2=(1+0.8*x2).*cos(100*pi*t)+0.1*ra ndn (1,N);
z2=fft(y2,256);
subplot(3,2,3);plot(t,y1);
grid on; legend('x(t)= -t+t0/4 的时域波形'); subplot(3,2,4);plot([-128:127],fftshift(abs(z2))); grid on; legend('x(t)= -t+t0/4 的频域波形'); x3=t-t0;
y3=(1+0.8*x3).*cos(100*pi*t)+0.1*ra ndn (1,N);
z3=fft(y3,256);
subplot(3,2,5);plot(t,y3);
grid on; legend('x(t)= t-t0 的时域波形'); subplot(3,2,6);plot([-128:127],fftshift(abs(z3))); grid on; legend('x(t)= t-t0 的频域波形');
实验图形如下图所示:
4.实现频分复用(FDM )已知三个已调制信号ap[k],经幅度调制而产生的FDMA
3
Ji ki
信号为 Sk] = ': ajp[k]bcos(—)
y 4
式中:ai 为常数;p[k]为具有窄带特性的Hanning 信号,其定义为
x(t)= t 的时域波形
1
…血刘啊
枷Fl
150p
100 ■-
50 -
0 - -200
利t 戶1的频域波形
100 200
160
x(t)- -t+tO/4的频域"坡形
1 4 1 1
■ ------ ------------------- --- ---
______________________
r~~
_________
■ 1 ~
i ■i I i i
1 Bl 1
- --- ----------- ---------------- --- ----------- -- ----------- --- ----
1 i I 1 1 1
1 _________________ 」 ________________________________
U .-W-.I#
1
i i 1 i
:
f.
-*L"a 7 ――Ju 电・•
100
2CJ0
-200
200
p[k]
0.5「0.5cos(
2 k
N -1
其他
■1
*100 0 x(t)= t-忆的时域波形
0.3
0.4
0.5
100
50
-100 0 100 1
"1
■1
0.2
03
0.4
0.5
50
*100
100
若将此已调信号通过信道传输,描述该信道的模型为宜全通系统,其差分方程为
y[k] -1.1172y[k -1] 0.9841 y[k -2] - 0.4022y[k -3] 0.2247y[k -44]
= 0.2247x[k] -0.4022x[k -1] 0.9841x[k -2] -1.1172x[k -3] x[k - 3]
已调信号s(k)通过该信道后,得到的接收信号为y(k) =s(k)* h(k)。

1
N=75;
k=0:N-1;
n=len gth(k);
p=0.5-0.5*cos(2*pi*k./(N-1));
z仁fft(p, n);
subplot(2,1,1);plot(k,p);grid on;legend('p(k) 的时域波形');
subplot(2,1,2);plot (k, fftshift(abs(z1)));grid on ;lege nd('p(k) 的频谱');
2
N=75;
k=O:N-1;
n=len gth(k);
p=0.5-0.5*cos(2*pi*k./(N-1));
s=p.*(cos(pi*k/4)+2*cos(pi*k/2)+3*cos(3*pi*k/4));
z2=fft(s, n);
subplot(2,1,1);plot (k,s);grid on ;lege nd('s(k) 的时域波形');
on ;lege nd('s(k) 的频谱
subplot(2,1,2);plot (k,fftshift(abs(z2)));grid ');
3
频率响应特性
a=[1 -1.1172 0.9842 -0.4022 0.2247];
b=[0.2247 -0.4022 0.9842 -1.1172 1];
w=li nspace(1,pi,512);
H=freqz(a,b,w);plot(w/pi,abs(H));
单位脉冲响应
a=[1 -1.1172 0.9842 -0.4022 0.2247]; b=[0.2247 -0.4022 0.9842 -1.1172 1]; n=-0.1:0.01:0.5;
x=impDT( n);
y=filter(b,a,x);
plot (n, y);grid on;
4
a=[1 -1.1172 0.9842 -0.4022 0.2247];
b=[0.2247 -0.4022 0.9842 -1.1172 1];
k=0:0.1:100;
p=0.5-0.5*cos(2*pi*k./74);
s=p.*(cos(pi*k/4)+2*cos(pi*k/2)+3*cos(3*pi*k/4));
y=filter(b,a,s);
z仁fft(y,256);
plot([-128:127],fftshift(abs(z1)));axis([-30 30 0 120]);grid on;
-30 010 2030。

相关文档
最新文档