Fskmod
Fskmod
clear all;
clc;
%% ASK Modulation %% ASK Demodulation
Tb = 1; t1 = 0;
fc = 10; t2 = Tb;
t = 0:Tb/100:1;
c = sqrt(2/Tb)*sin(2*pi*fc*t); for i = 1:N
N = 8; t = (t1 : Tb/100 : t2);
m = rand(1,N); x = sum(c.*ask_sig(i,:));
t1 = 0; %correlator
t2 = Tb; if x > 0
demod(i) = 1;
for i = 1:N else
t = (t1 : Tb/100 : t2); demod(i) = 0;
if m(i) > 0.5 end
m(i) = 1; t1 = t1 + (Tb + Tb/100);
m_s = ones(1, length(t)); t2 = t2 + (Tb + Tb/100);
else end
m(i)=0;
m_s = zeros(1, length(t)); subplot(5,1,5);
end stem(demod, 'filled', 'black');
message(i,:) = m_s; title('ASK Demodulation')
ask_sig(i,:) = c.*m_s; xlabel('Time(s)')
ylabel('Amplitude')
t1 = t1 + (Tb + Tb/100);
t2 = t2 + (Tb + Tb/100);
subplot(5,1,2);
axis([0 N -2 2]);
plot(t, message(i,:), 'black');
title('Message signal');
xlabel('Time(s)')
ylabel('Amplitude')
hold on;
subplot(5,1,4);
plot(t, ask_sig(i,:), 'black');
title('ASK signal');
xlabel('Time(s)')
ylabel('Amplitude')
hold on;
end
hold off;
subplot(5,1,3);
plot(t, c, 'black');
title('Carrier Signal')
xlabel('Time(s)')
ylabel('Amplitude')
subplot(5,1,1);
stem(m, 'filled', 'black');
title('Message Signal')
xlabel('Time(s)')
ylabel('Amplitude')