% File: E5_086.M

clear;

f2 = 1070;
fl = 2070;
% Note: f2<fl
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;

temp = Sa(xp);
for (i = 1:1:length(temp))
  temp(i) = temp(i)*(-1)^(i-1);
end;

c = (Ac/2)*(Sa(xn) + temp);

% Computing the one-sided spectrum.  
%   Compare with Fig. 5-26a.
SdB = 20 * log10(abs(c));

axis([min(fn)-100 max(fn)+100 min(SdB) max(0,ceil(max(SdB)))]);
plot(fn,SdB,'o');
for (i = 1:1:length(fn))
  line([fn(i) fn(i)], [min(SdB) SdB(i)]);
end;

xlabel('f(n)');
ylabel('SdB(f,n)');
title(['One-sided Spectrum from fc = ',int2str(fc),' to fc+5R']);
axis;



