goldriver
Junior Member level 2
- Joined
- Dec 9, 2012
- Messages
- 23
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,476
I am having problems understanding the following code in matlab which implements an FFT algorithm using butterfly.
I am stuck at the input ordering part which arranges the indices together in such a way that a butterfly could be implemented. Is there a way to possibly arrange the indices in the way we require to implement a butterfly?
Code:
N1=8;
% disp('Enter the sample values using ENTER KEY');
% fs=2*N1;
% n=0:1/fs:1;
% x=sin(2*pi*100*n);
x=[1 2 3 4 5 6 7 8];
m=ceil(log2(N1));
% to ensure we compute an FFT that is in
% powers of 2 we use the above and below
% command
N=2^m;
% p=N-N1;
%zero-padding
x2=x;
% if (p~=0)
% x1=zeros(1,p);
% x2=[x2 x1];
% end
p=N-length(x2);
if(p>0)
x1=zeros(1,p);
x2=[x2 x1]
end
Last edited by a moderator: