📄 jiet.m
字号:
t=-2:0.001:2; %%信号f(t)
y1=sinc(t*200);
subplot(2,3,1),plot(t,y1); %画出原始信号
title('已知信号');
xlabel('时间:s');
ylabel('幅度');
grid
xlim([-0.1,0.1]);
fs=3000 %%信号频谱
t1=-2:0.0001:2;
y11=sinc(t1*200);
yk=fft(y11,50000); %对信号做傅立叶变换
yw=2*pi/40000*abs(fftshift(yk)); %频谱搬移
fw=[-25000:24999]/50000*fs ;
subplot(2,3,2),plot(fw,yw);
title('已知信号的频谱');
xlabel('频率:hz');
ylabel('幅度');
grid
xlim([-30,30]);
y3=cos(2*pi*200*t); %%载波信号
subplot(2,3,3),plot(t,y3);
title('载波信号');
xlabel('时间:s');
ylabel('幅度');
grid
xlim([-0.1,0.1]);
y4=sinc(t*200).*cos(2*pi*200*t); %%已调信号
subplot(2,3,4),plot(t,y4,'r-');
title('已调信号');
xlabel('时间:s');
ylabel('幅度');
grid
xlim([-0.05,0.05]);
fs1=1000; %已调信号频谱
yk=fft(y4,5000); %对信号做傅立叶变换
yw=2*pi/4000*abs(fftshift(yk)); %频谱搬移
fw=[-2500:2499]/5000*fs1;
subplot(2,3,5),plot(fw,yw,'r-');
title('已调信号的频谱');
xlabel('频率:hz');
ylabel('幅度');
grid
xlim([-400,400]);
[c,lags]=xcorr(y4,200); %%DSB信号自相关函数
figure %200表示自相关函数时间т
subplot(2,1,1);
plot(lags/fs,c);
title('DSB信号自相关函数');
xlabel('t');
ylabel('Rxx(t)');
grid
SDSBp=fft(c,5000); %%DSB功率谱
fw=[-2500:2499]/5000*fs1;
yw=2*pi/4000*abs(fftshift(SDSBp));%频谱搬移
subplot(2,1,2);
plot(fw,yw);
title('DSB信号功率谱');
xlabel('w');
ylabel('Rxx(t)');
grid
y7=y4.*y3; %%解调信号
figure
subplot(2,1,1);
plot(t,y7);
title('解调信号');
xlabel('时间:s');
ylabel('幅度');
grid
xlim([-0.1,0.1]);
Rp=0.1; %%滤波后的f(t)信号
Rs=80; %信号衰减幅度
Wp=40/100; %通带截止频率
Ws=45/100; %阻带截止频率,100为载波频率的一半
[n,Wn]=ellipord(Wp,Ws,Rp,Rs); %阶数n
[b,a]=ellip(n,Rp,Rs,Wn); %传递函数分子分母b,a
Xl=5*filter(b,a,y7);
figure;
subplot(2,1,1);
plot(t,Xl);
title('滤波后的f(t)信号');
xlabel('时间单位:s');
ylabel('幅度');
grid;
xlim([-0.1,0.1]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -