Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] does fft function in matlab have gain?

Status
Not open for further replies.

yamid

Newbie level 5
Joined
Sep 13, 2011
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,406
hello all,
i wrote this code:

N=10000; %number of data bits
data=randn(1,N)>=0; %Generate uniformly distributed random data
Fs=20*10.7e+6; %Sampling frequency
Rb=Fs*(1/10);
Tb=1/Rb;
Fc=10.7e+6;
snrdb=10; % Eb/N0 range in dB for simulation
time_bpsk=0:(1/Fs):Tb*(length(data))-(1/Fs);
carrier=cos(2*pi*Fc*time_bpsk);
figure; plot(abs(fft(carrier)));

can someone explain me why the harmonies amplitude is so high? (5*10^4!!!!)
(i know that by theory the harmonies amplitude should be 1/2 if you insert signal with unot amplitude.)
 

Hiya yamid,

No, it doesn't have gain - it's just MATLAB's implementation of the FFT doesn't renormalise the result by 1/N as some other approaches do.
Your code works fine if you either:

a) use the ifft function instead (it DOES renormalise... but bear in mind that the phases of your frequency components will all flip signs), or
b) change the last line to: figure; plot(abs(fft(carrier)/length(carrier)));

Cheers :)
 
  • Like
Reactions: yamid

    yamid

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top