matlab仿真ssb调制

这边先保存代码,讲解以后

clear all;
close all;
fs=100000000;   %采样频率
T=1/fs;
L = 1000000;
t=(0:L-1)*T; 
n = 2^nextpow2(L);
f1=3000;   %调制信号频率  
f2=50000;  %

signal1=cos(2*pi*f1*t);  %调制信号
signal2=sin(2*pi*f2*t);
signal3=cos(2*pi*f2*t);

subplot(321);
plot(t,signal1);
axis([0 0.001 -inf inf]);
title('5khz的调制信号的时域');
subplot(322);
Y=fft(signal1,n);
f = fs*(0:(n/2))/n;
P = abs(Y/n);
plot(f,P(1:n/2+1));
axis([0  100000 -inf inf]);
title('5khz的调制信号的频域');

subplot(323);
plot(t,signal2);
axis([0 0.001 -inf inf]);
title('50khz的调制信号的时域');
subplot(324);
Y=fft(signal2,n);
f = fs*(0:(n/2))/n;
P = abs(Y/n);
plot(f,P(1:n/2+1));
axis([0  100000 -inf inf]);
title('50khz的调制信号的频域');

subplot(325);
plot(t,signal3);
axis([0 0.001 -inf inf]);
title('50khz的调制信号的时域');
subplot(326);
Y=fft(signal3,n);
f = fs*(0:(n/2))/n;
P = abs(Y/n);
plot(f,P(1:n/2+1));
axis([0  100000 -inf inf]);
title('50khz的调制信号的频域');

figure(2)
subplot(221)
m1=signal1.*signal2;
plot(t,m1);
axis([0 0.001 -inf inf]);
subplot(222);
Y=fft(m1,n);
f = fs*(0:(n/2))/n;
P = abs(Y/n);
plot(f,P(1:n/2+1));
axis([0  100000 -inf inf]);

subplot(223)
m2=signal1.*signal3;
plot(t,m2);
axis([0 0.001 -inf inf]);
subplot(224)
Y=fft(m2,n);
f = fs*(0:(n/2))/n;
P = abs(Y/n);
plot(f,P(1:n/2+1));
axis([0  100000 -inf inf]);

figure(3)
subplot(211)
Hd = filter3;
output1=filter(Hd,m1);
plot(t,output1);
axis([0 0.001 -inf inf]);
subplot(212)
Hd = filter3;
output2=filter(Hd,m2);
plot(t,output2);
axis([0 0.001 -inf inf]);

figure(4)
f3=10000000;%10M
subplot(211)
signal4=sin(2*f3*t);
plot(t,signal4);
axis([0 0.000001 -inf inf]);
subplot(212)
signal5=cos(2*f3*t);
plot(t,signal5);
axis([0 0.000001 -inf inf]);

figure(5)
out=output1.*signal4+output2.*signal5;
plot(t,out);
axis([0 0.00001 -inf inf]);
发布了115 篇原创文章 · 获赞 38 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44146373/article/details/105657078