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.

help me in FFT normalization!!

Status
Not open for further replies.

vjfaisal

Full Member level 4
Joined
Sep 24, 2006
Messages
205
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
pakistan
Activity points
2,701
fft normalization

hi

please help me , if anyone knows

Q1: how to normalize the FFT plot.

Q2: how to convert fft normalize frequency in HERTZ along x-axis

please help me in these questions....

best regards
 

normalize fft

It sometimes depends on who's FFT function you are using.
Here is a MATLAB example. Notice the fs/N and 2/N.
If you are unfamiliar with MATLAB, the abs() function returns the magnitude of a complex number.

Code:
N  = 64;        % number of points
fs = 4000;      % sample rate
f1 = 750;       % signal 1 frequency
f2 = 1000;      % signal 2 frequency
a1 = 1.5;       % signal 1 amplitude
a2 = 2.3;       % signal 2 amplitude
t = (0 : N-1) / fs;
y = a1*cos(2*pi*f1*t) + a2*cos(2*pi*f2*t);
h = fft(y);
% Discard duplicate upper half. Scale frequency and amplitude.
freq = fs/N * (0 : N/2);
plot(freq, 2/N * abs(h(1 : N/2+1))); xlabel('Hertz');
 

matlab fft normalization

DSB-AM

fs=1000 ;
ts=0,001;
n=[0:1/fs:1];
fc=150;
fm=15;
faz=0;


t=cos(2*pi*n*fc+faz); % carrier signal

m=cos(2*pi*n*fm); % message signal





figure;
subplot(2,1,1);
plot(n,t);
axis([0 0.05 -1 1]);
title('carrier signal');
subplot(2,1,2);
plot(n,m);
axis([0 0.5 -1 1]);
title('message signal');




tf=fft(t)/length(t);

tfg=abs(tf);

tfg=fftshift(tfg);

eks=[-fs/2:1:fs/2];



mf=fft(m)/length(m);

mfg=abs(mf);

tfg=fftshift(tfg);






r=1*m.*t;

rf=fft(r)/length(r);

rfg=abs(rf);

rfg=fftshift(rfg) ;



figure;
subplot(3,1,1)
plot(eks,tfg)
title('frequency spectrum of carrier signal')

subplot(3,1,2);
plot(eks,mfg);
title('frequency spectrum of message signal')

subplot(3,1,3);
plot(eks,rfg);
title('frequency spectrum of DSB-AM modulation signal')





figure;
plot(m,'r:*');
axis([0 100 -1 1]);
hold on;
plot(r,'k');
axis([0 100 -1 1]);
title('time domain spectrum of message signal and carrier signal')
 

fft normalize

echo47 said:
It sometimes depends on who's FFT function you are using.
Here is a MATLAB example. Notice the fs/N and 2/N.
If you are unfamiliar with MATLAB, the abs() function returns the magnitude of a complex number.

Code:
N  = 64;        % number of points
fs = 4000;      % sample rate
f1 = 750;       % signal 1 frequency
f2 = 1000;      % signal 2 frequency
a1 = 1.5;       % signal 1 amplitude
a2 = 2.3;       % signal 2 amplitude
t = (0 : N-1) / fs;
y = a1*cos(2*pi*f1*t) + a2*cos(2*pi*f2*t);
h = fft(y);
% Discard duplicate upper half. Scale frequency and amplitude.
freq = fs/N * (0 : N/2);
plot(freq, 2/N * abs(h(1 : N/2+1))); xlabel('Hertz');

Hi echo47,

I used your MATLAB code, but changed the values of N and fs:
N = 4096;
fs = 10000;

The result turns out to be strange (see the figure).

**broken link removed**

What's wrong with it?

Thanks
 

normalize fft matlab

Can anyone show me what's wrong in the result in the previous post please?

I used MATLAB code of echo47, and just modified the first 2 lines:

Code:
N  = 4096;        % number of points = 2^12  <<<---this line
fs = 10000;      % sample rate     <<<---this line

f1 = 750;       % signal 1 frequency 
f2 = 1000;      % signal 2 frequency 
a1 = 1.5;       % signal 1 amplitude 
a2 = 2.3;       % signal 2 amplitude 
t = (0 : N-1) / fs; 
y = a1*cos(2*pi*f1*t) + a2*cos(2*pi*f2*t); 
h = fft(y); 
% Discard duplicate upper half. Scale frequency and amplitude. 
freq = fs/N * (0 : N/2); 
plot(freq, 2/N * abs(h(1 : N/2+1))); xlabel('Hertz');

But the result (as shown in the figure) is so strange:
- The 1st component: f = 749.5Hz, amplitude = 1.406 !? (It should be 750Hz, 1.5)
- The 2nd component: f = 1001Hz, amplitude = 1.743 !? (It should be 1000Hz, 2.3)

Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top