-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample5_09.m
More file actions
78 lines (63 loc) · 1.43 KB
/
Example5_09.m
File metadata and controls
78 lines (63 loc) · 1.43 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
67
68
69
70
71
72
73
74
75
76
77
78
% File: Example5_09.m for Example 5-9
clear;
clf
% Calculate & Plot Originate Modem Transmit Spectrum
f2 = 1070;
fl = 1270;
% Note: f1>f2
R = 300;
h = (fl-f2)/R;
Ac = 1;
n = 0:1:10;
xn = 0.5*pi*(h-n);
xp = 0.5*pi*(h+n);
fc = 0.5*(fl+f2);
fn = 0.5*n*R + fc;
% Computing the one-sided spectrum, i.e the spectrum for f>=fc.
temp = SA(xp);
for (i = 1:1:length(temp))
temp(i) = temp(i)*(-1)^(i-1);
end;
c = (Ac/2)*(SA(xn) + temp);
SdB = 20 * log10(abs(c));
% Compare with Fig. 5-26a.
subplot(211)
plot(fn,SdB,'o');
for (i = 1:1:length(fn))
line([fn(i) fn(i)], [min(SdB) SdB(i)]);
end;
xlabel('f -->');
ylabel('SdB(f)');
axis([1000 3200 -40 0])
title(['Originate Transmit Spectrum for f>=fc where fc = ',int2str(fc),', R = ',num2str(R), ', h = ',num2str(h)]);
grid;
% Calculate & Plot Answer Modem Transmit Spectrum
f2 = 2025;
fl = 2225;
% Note: f1>f2
R = 300;
h = (fl-f2)/R;
Ac = 1;
n = 0:1:10;
xn = 0.5*pi*(h-n);
xp = 0.5*pi*(h+n);
fc = 0.5*(fl+f2);
fn = 0.5*n*R + fc;
% Computing the one-sided spectrum, i.e the spectrum for f>=fc.
temp = SA(xp);
for (i = 1:1:length(temp))
temp(i) = temp(i)*(-1)^(i-1);
end;
c = (Ac/2)*(SA(xn) + temp);
SdB = 20 * log10(abs(c));
subplot(212)
plot(fn,SdB,'o');
for (i = 1:1:length(fn))
line([fn(i) fn(i)], [min(SdB) SdB(i)]);
end;
xlabel('f -->');
ylabel('SdB(f)');
axis([1000 3200 -40 0])
title(['Answer Transmit Spectrum for f>=fc where fc = ',int2str(fc),', R = ',num2str(R), ', h = ',num2str(h)]);
grid;