-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample5_13.m
More file actions
66 lines (50 loc) · 1.14 KB
/
Example5_13.m
File metadata and controls
66 lines (50 loc) · 1.14 KB
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
64
65
66
% File: Example5_13.m for Example 5-13
clear;
clf
% Use data shown in Fig. 5-34 and compute Type II MSK results.
d = [1 -1 1 -1 -1 1 1 -1 1 -1];
Ac = 1;
fc = 3;
Tb = 1;
wc = 2*pi*fc;
dt = 1/(5*fc);
t = 0:dt:10*Tb;
nx = 2:2:10;
ny = 1:2:9;
% Generating x(t)
x = zeros(length(t),1);
for (i = 1:1:length(nx))
temp = Ac * d(nx(i)) * cos(pi*(t - nx(i)*Tb)/2*Tb);
temp = temp(:);
x = x + temp .* (U_STEP(t,-Tb+nx(i)*Tb) - U_STEP(t,Tb+nx(i)*Tb));
end;
% Generating y(t)
y = zeros(length(t),1);
for (i = 1:1:length(ny))
temp = Ac * d(ny(i)) * sin(pi*(t + Tb - ny(i)*Tb)/2*Tb);
temp = temp(:);
y = y + temp .* (U_STEP(t,-Tb+ny(i)*Tb) - U_STEP(t,Tb+ny(i)*Tb));
end;
% Generating s(t)
temp = cos(wc*t);
temp1 = sin(wc*t);
temp = temp(:);
temp1 = temp1(:);
s = x.*temp - y.*temp1;
% Generating Plots
subplot(311);
plot(t,x);
xlabel('t -->');
ylabel('x(t)');
title('In-phase Modulation, x(t), for Type II MSK');
subplot(312);
plot(t,y);
xlabel('t -->');
ylabel('y(t)');
title('Quad-phase Modulation, y(t), for Type II MSK');
subplot(313);
plot(t,s);
xlabel('t -->');
ylabel('s(t)');
title('Type II MSK Signal, s(t)');