SSB With Out Using Inbuilt Functions with Waveforms

By
Advertisement
clc;
clear all;
close all;
fc=100;
fm=fc/10;
fs=100*fc;
ac=1;am=1;
t=0:1/fs:4/fm;
ct=ac*cos(2*pi*fc*t);
mt=am*cos(2*pi*fm*t);
xh=cos((2*pi*fm*t)-pi/2)
stu=mt.*cos(2*pi*fc*t)-xh.*sin(2*pi*fc*t)
stl=mt.*cos(2*pi*fc*t)+xh.*sin(2*pi*fc*t)
figure(1)
subplot(6,1,1);plot(t,ct);
xlabel('time period');
ylabel('amplitude');
title('carrier signal');
subplot(6,1,2),plot(t,mt);
xlabel('time period');
ylabel('amplitude');
title('message signal');
subplot(6,1,3);plot(t,stu);
xlabel('time period');
ylabel('amplitude');
title('upper side band signal in timedomain');
subplot(6,1,4);plot(t,stl);
xlabel('time period');
ylabel('amplitude');
title('lower side band signal in timedomain');
%spectrum
stu_frequency=fftshift(abs(fft(stu)));
f1=-fs/2:fs/(length(stu_frequency)-1):fs/2;
subplot(6,1,5);
plot(f1,stu_frequency);
xlabel('frequency');
ylabel('amplitude');
title('upper side band frequency');
axis([-150 150 0 2000]);
stl_frequency=fftshift(abs(fft(stl)));
f2=-fs/2:fs/(length(stl_frequency)-1):fs/2;
subplot(6,1,6);
plot(f2,stl_frequency);
xlabel('frequency');
ylabel('amplitude');
title('lower side band frequency');
axis([-150 150 0 2000]);
% demodulation
figure(2)
dt=ct.*stu;
filter=fir1(200,fm/fs,'low');
original_t_signal=conv(filter,dt);
original_f_signal=fftshift(abs(fft(original_t_signal)));
t1=0:1/(length(original_t_signal)-1):1;
f3=-fs/2:fs/(length(original_f_signal)-1):fs/2;
subplot(2,1,1);plot(t1,original_t_signal);
xlabel('time period');
ylabel('amplitude');
title('time domain signal');
subplot(2,1,2);plot(f3,original_f_signal);
axis([-50 50 0 2000]);
xlabel('frequency');
ylabel('amplitude');
title('frequency domain signal');









0 comments:

Post a Comment