You are on page 1of 3

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ButterflyFFT { class Program { static void Main(string[] args) { double[] X; X = new double[8]; X[0] = 1; X[1] = 2; X[2] = 3; X[3] = 4; X[4] = 5; X[5] = 6; X[6] = 7; X[7] = 8; double[] double[] double[] double[] double[] double[] X11 = ImX11 X21 = X22 = X23 = X24 = X11; ImX11; X21; X22; X23; X24;

new double[4]; = new double[4]; new double[4]; new double[4]; new double[2]; new double[2];

X21[0]=X[0]+X[4]; X21[1] = X[0] - X[4]; X22[0] = X[2] + X[6]; X22[1] = X[2] - X[6]; X23[0] = X[1] + X[5]; X23[1] = X[2] - X[5]; X24[0] = X[3] + X[7]; X24[1] = X[3] - X[7];

/// X21[2] = X[0] + X[4]; X22[2] = X22[0]; X21[3] = X21[1]; X22[3] = X[2] - X[6]; ///Calculation of Real Part Only X11[0] = X21[0] + X22[0]; X11[1] = X21[1]; X11[2] = X21[2] - X22[2]; X11[3] = X21[1]; /////Calculation of Imaginary Part ImX11[0] = 0; ImX11[1] = -1 * X22[1]; ImX11[2] = 0; ImX11[3] = X22[1]; Console.WriteLine(" FFT Processing of X[n] signal "); for (int i = 0; i < X.Length; i++) { Console.WriteLine("X[{0}]={1}", i, X[i]); }

Console.WriteLine("Output of FFT Transform "); Console.WriteLine("Output of Real FFT Transform "); for (int i = 0; i < X11.Length; i++) { Console.WriteLine("X11[{0}]={1}", i, X11[i]); } Console.WriteLine("Output of Imaginary FFT Transform ");

for (int i = 0; i < X11.Length; i++) { Console.WriteLine("ImX11[{0}]={1}", i, ImX11[i]); }

Console.ReadLine(); } } }

You might also like