Problem with amplitude and smoothness of FFT

조회 수: 3 (최근 30일)
Amy Lg
Amy Lg 2022년 1월 10일
편집: Amy Lg 2022년 1월 16일
Hi,
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);
end
Digit = [Digit sig];
end
mod = Digit .* cos(2*pi*Fc*t);
Signal = Signal + mod; % final signal
end
subplot(2,1,1)
plot(t,Signal);
xlabel('Time (ns)');
ylabel('Amplitude');
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;
subplot(2,1,2)
plot(freq,abs(xdft)/max(abs(xdft)))
axis([194.94e3 195.94e3 0 1]);
xlabel('Frequency (GHz)');
ylabel('Amplitude');
title('FFT of final Signal');

채택된 답변

Paul
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
Paul
Paul 2022년 1월 14일
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 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개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by