t=linspace(0,1,1000);
g1 = cos(2*pi*100*t)+cos(2*pi*200*t); % target signal.
G1 = fftshift(fft(g1));
G1 = G1.* conj(G1) / 1000;
in = cos(2*pi*50.*t); % input signal.
IN = fftshift(fft(in));
IN = IN.* conj(IN) / 1000;
g = conv(g1,in); % convolution.
%dsb = g1+in; % DSB Mod.
dsb = g1.*in; % DSB Mod.
f=[-500:499];
G=fft(g);
G=fftshift(G);
realG = G.* conj(G) / 1000;
DSB=fftshift(fft(dsb));
realDSB = DSB.* conj(DSB) / 1000;
subplot(4,1,1);
plot(f,G1);
title('target signal');
subplot(4,1,2);
plot(f,IN);
title('input signal');
subplot(4,2,5);
plot(t,g(1:1000));
axis([0 0.05 -5 5]);
title('convolution signal in time');
subplot(4,2,7);
plot(f,realG(1:1000));
title('convolution signal in freq.');
subplot(4,2,6);
plot(t,dsb);
axis([0 0.05 -5 5]);
title('DSB signal in time');
subplot(4,2,8);
plot(f,realDSB);
title('DSB signal in freq.');
댓글 달기