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.

Matlab- Function to FFT decimation in Frequency RADIX 2

Status
Not open for further replies.

claudiocamera

Full Member level 4
Joined
Aug 19, 2005
Messages
224
Helped
27
Reputation
54
Reaction score
6
Trophy points
1,298
Location
Salvador-BA-Brazil
Activity points
4,282
decimation in frequency

Hi,

I am trying to develop a function in Matlab to calculate FFT using DIF RADIX 2. In order to test it , firstly I am working with a signal with length =8 x= [0 1 2 3 4 5 6 7]. Unfortunatelly it is not returning the correct result, I cant find what is wrong with the algorithm.

If somebody realise what is wrong in the code below, please let me know.

Thxs
% x= Imput data

x=[0 1 2 3 4 5 6 7];

% Length of imput data
N=length(x);


x; % Buffer x

% Twidle factor

WN=exp(-j*2*pi/N);

% FFT routine



passo=N/2;

for Ni = 1:est

h=2^(Ni-1);
v=N/h;

for m=0:v:N-1

for z = 1:passo
xnew(z+m)=x(z+m)+x(z+passo+m);
xnew(z+passo+m)=x(z+m)-x(z+passo+m)*WN^((z-1)*h);
end

end


passo=passo/2;

x=xnew;


end


% bit reverse routine

xbr=zeros(1,N);

dec=[0:N-1];

bin=dec2bin(dec);

dec1=bin2dec(fliplr(bin))';
dec1=dec1+ones(1,N);

for i = 1:N;
xbr(i)=x(dec1(i));
end
 

matlab program for radix 2 fft

Mr. try to avoid loops and try using vector operations like ./ , .* , .^ etc
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top