% Message Signal % Carrier Signal Frequency % Carrier Signal % Phase Deviation % Modulated Signal % Demodulated Signal
% Message Signal % Carrier Signal Frequency % Carrier Signal % Phase Deviation % Modulated Signal % Demodulated Signal
fs = 6000;
t = 0:1/fs:1;
fm = 2;
x = cos(7*pi*fm*t); % message signal
fc = 40; % carrier signal frequency
y = sin(7*pi*fc*t); % carrier signal
phasedev = pi/6; % phase deviation
phasemod = pmmod(x,fc,fs,phasedev); % modulated signal
phasedemod = pmdemod(phasemod,fc,fs,phasedev); % demodulated signal
subplot(4,1,1);
plot(t,x);
title('Message Signal');
subplot(4,1,2);
plot(t,y);
title('Carrier Signal');
subplot(4,1,3);
plot(t,phasemod);
title('Phase Modulated Signal');
subplot(4,1,4);
plot(t,phasedemod);
title('Demodulated Signal');
5-amaliy ish
KOD FRAGMENTI:
x = input('Enter Digital Input Information = '); % Binary information as stream of bits (binary
signal 0 or 1)
N = length(x);
disp(x);
digit = [];
for n = 1:1:N
if x(n) == 1;
sig = ones(1,nb);
else x(n) == 0;
sig = zeros(1,nb);
end
end
subplot(3,1,1);
plot(t1,digit,'LineWidth',2.5);
grid on;
ylabel('Amplitude(Volts)');
mod = [];
for (i = 1:1:N)
if (x(i) == 1)
else
end
end
subplot(3,1,2);
plot(t3,mod);
xlabel('Time(Sec)');
ylabel('Amplitude(Volts)');
x = mod;
h = 1; % Signal fading
w = 0; % Noise
y = h.*x + w; % Convolution
% *************************** ASK Demodulation ****************************
s = length(t2);
demod = [];
for n = s:s:length(y)
mm = c.*y((n-(s-1)):n); % Convolution
t5 = Tb/nb:Tb/nb:Tb;
z = trapz(t5,mm); % Intregation
rz = round((2*z/Tb));
a = 1;
else
a = 0;
end
end
disp(demod);
digit = [];
for n = 1:length(demod);
if demod(n) == 1;
sig = ones(1,nb);
else demod(n) == 0;
sig = zeros(1,nb);
end
end
plot(t5,digit,'LineWidth',2.5);grid on;
xlabel('Time(Sec)');
ylabel('Amplitude(Volts)');
6-amaliy ish
x = input('Enter Digital Input Information = '); % Binary information as stream of bits (binary
signal 0 or 1)
N = length(x);
disp(x);
for n = 1:1:N
if x(n) == 1;
sig = ones(1,nb);
else x(n) == 0;
sig = zeros(1,nb);
end
end
subplot(3,1,1);
plot(t1,digit,'LineWidth',2.5);
grid on;
xlabel('Time(Sec)');
ylabel('Amplitude(Volts)');
mod = [];
for (i = 1:1:N)
if (x(i) == 1)
else
end
mod = [mod y];
end
subplot(3,1,2);
plot(t3,mod);
xlabel('Time(Sec)');
ylabel('Amplitude(Volts)');
x = mod;
h = 1; % Signal fading
w = 0; % Noise
y = h.*x + w; % Convolution
s = length(t2);
demod = [];
for n = s:s:length(y)
t5 = Tb/nb:Tb/nb:Tb;
z1 = trapz(t5,mc1); % Intregation
z2 = trapz(t5,mc2); % Intregation
rz1 = round(2*z1/Tb);
rz2 = round(2*z2/Tb);
a = 0;
end
end
disp(demod);
digit = [];
for n = 1:length(demod);
if demod(n) == 1;
sig = ones(1,nb);
else demod(n) == 0;
sig = zeros(1,nb);
end
end
subplot(3,1,3)
plot(t5,digit,'LineWidth',2.5);grid on;
xlabel('Time(Sec)');
ylabel('Amplitude(Volts)');