Assignment 03 DSP
Assignment 03 DSP
1.
2.
The radix-2 butterfly combines two complex numbers with a twiddle factor W, using the
following equations
Where
#include <stdio.h>
#include <complex.h>
int main() {
return 0;
Output
3.
4.
Discrete Fourier Transform (DFT) Code
#include <stdio.h>
#include <math.h>
#include <complex.h>
#include <time.h>
// DFT Function
X[k] = 0;
int main() {
// Input sequence
// Time tracking
start = clock();
// Compute DFT
DFT(x, X);
// Measure time
end = clock();
printf("DFT Results:\n");
return 0;
Output
X[0] = 36.00 + 0.00i
#include <math.h>
#include <complex.h>
#include <time.h>
if (n <= 1) return;
even[i] = x[i*2];
odd[i] = x[i*2+1];
FFT(even, n/2);
FFT(odd, n/2);
x[k] = even[k] + t;
x[k + n/2] = even[k] - t;
int main() {
// Input sequence
// Time tracking
start = clock();
// Compute FFT
FFT(x, N);
// Measure time
end = clock();
printf("FFT Results:\n");
return 0;
Output
X[0] = 36.00 + 0.00i
5.