Problem with amplitude and smoothness of FFT

3 ビュー (過去 30 日間)
Amy Lg
Amy Lg 2022 年 1 月 10 日
編集済み: Amy Lg 2022 年 1 月 16 日
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');


Paul 2022 年 1 月 12 日
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.
  7 件のコメント
Amy Lg
Amy Lg 2022 年 1 月 14 日
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.


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by