-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAmplitude_Modulation.m
63 lines (53 loc) · 1.16 KB
/
Amplitude_Modulation.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
clc;
close all;
clear all;
% Modulating index
m_critical = 1; %critical
m_over = 1.5; %over
m_under = 0.5; %under
% Amplitude of modulating signal
Am = 10;
% Frequency of modulating signal (Hz)
fm = 5;
% Time period of modulating signal (s)
Ta = 1/fm;
t = 0:(Ta/1000):1;
% Modulating signal
ym = Am*cos(2*pi*fm*t);
figure(1)
subplot(4,1,1)
plot(t,ym)
grid on;
xlabel('Time Index')
ylabel('Amplitude')
title('Modulating Signal')
% Relation between Am/Cm and fc/fa
Ac = Am/m_critical; %Change in modulation index
fc = fm*15; %Relationship equation
Tc = 1/fc;
% Carrier signal
yc = Ac*cos(2*pi*fc*t);
subplot(4,1,2)
plot(t,yc)
grid on;
xlabel('Time Index')
ylabel('Amplitude')
title('Carrier Signal')
% Amplitude Modulation
y_mod = (Ac+ym).*cos(2*pi*fc*t);
subplot(4,1,3)
plot(t,y_mod)
grid on;
xlabel('Time Index')
ylabel('Amplitude')
title('Amplitude Modulated Signal')
%Amplitude Demodulation
y_demo = y_mod.*yc;
[b,a] = butter(5,0.01);
y_demo_filtered = filter(b,a,y_demo);
subplot(4,1,4)
plot(t,y_demo_filtered);
grid on;
xlabel('Time Index')
ylabel('Amplitude')
title('Demodulation after filter application')