Problem with amplitude and smoothness of FFT

3 views (last 30 days)
I am trying to create 10 individual signals with on-off keying modulation format, add them up to have a final signal, and then take a Fourier transform of that signal. I tried to zero padd the final signal before taking fft so that I can correct amplitude for my spectrum based on this link:
However, I still do not get amplitude one for frequencies of interest.
clc, clear all, close all;
NStep = 20; % the number of bits
R = 20; % Bit rate (Gbps)
Tr = 1/R; % bit period (nanosecond)
fc = [195.89e3 195.79e3 195.69e3 195.59e3 195.49e3 195.39e3 195.29e3 195.19e3 195.09e3 194.99e3]; %carrier freq.(GHz)
Signal = 0;
for Iter = 1:numel(fc)
Fc = fc(Iter); % Carrier frequency
x = randi([0,1],1,NStep); % Binary information as stream of bits (binary signal 0 or 1)
N = length(x);
nb = 1e6; % Digital signal per bit
t = Tr/nb:Tr/nb:nb*N*(Tr/nb); % Time period (ns)
Digit = [];
for n = 1:1:N
if x(n) == 1;
sig = ones(1,nb);
else x(n) == 0;
sig = zeros(1,nb);
Digit = [Digit sig];
mod = Digit .* cos(2*pi*Fc*t);
Signal = Signal + mod; % final signal
xlabel('Time (ns)');
title('OOK Modulated Signal');
%% fft
lpad = length(Signal);
xdft = fft(Signal,lpad);
xdft = xdft(1:lpad/2+1);
xdft = xdft/length(Signal);
xdft(2:end-1) = 2*xdft(2:end-1); %multiply all frequencies except 0 and the Nyquist by 2.
fs = 1/(Tr/nb);
freq = 0:fs/lpad:fs/2;
axis([194.94e3 195.94e3 0 1]);
xlabel('Frequency (GHz)');
title('FFT of final Signal');

Accepted Answer

Paul on 12 Jan 2022
The time domain signal, Signal, is not a sum of pure cosines because of how Digit is calculated, so we shouldn't expect its fft to be "nice."
Change this line
% mod = Digit .* cos(2*pi*Fc*t); % OOK Modulation
mod = cos(2*pi*Fc*t); % OOK Modulation
and the result will be very nice, which illustrates the effect of Digit.
Paul on 14 Jan 2022
I'm sure you could do various things to get more ones than zeros, but I'm not sure why you would do that. Then again, I'm not familiar with this specific application.
My sense is that any randomness in mod will ensure that the unnormalized peaks at the carriers will not be the same, so normalizing them all by the same value won't achieve unit amplitude at each peak.
Amy Lg
Amy Lg on 14 Jan 2022
Sometimes the amplitude of the spectrum for a peak is very low and this can make problem in my system later on.
Thanks for your help.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!