Questions tagged [dft]

Discrete Fourier transform (DFT) is a specific kind of discrete transform, used in Fourier analysis.

Given a sequence of N samples f(n), indexed by n = 0..N-1, the discrete Fourier transform (DFT) is defined as F(k), where k=0..N-1:

Enter image description here

Source: engineeringproductivitytools

428 questions
7
votes
3 answers

Discrete Fourier transform giving incorrect results

I am trying to do discrete Fourier transforms in C. Initially just the brute-force method. First I had the program open a data file (of amplitudes) and put the data into an array (just one, since I'm limiting myself to real-valued input). But the…
Ravenchant
  • 73
  • 4
7
votes
1 answer

How can I get DFT/FFT output frequencies in Hertz?

I want to develop musical notes detector as my degree project and I want to do it from scratch. I have written code for ".wav" file which extracts all info from that audio music file and gives me amplitude as a result. Then I have written a code for…
mossad
  • 73
  • 1
  • 2
  • 7
7
votes
1 answer

unit of fft(DFT) x axis

Possible Duplicate: How to get Frequency from FFT result I am somehow confused with the x axis of fft(DFT) command in Matlab. When we do a fft command for a signal which has sampled in n point, we get a plot in which the x axis is 0 to n-1. Does…
shaloo shaloo
  • 213
  • 1
  • 2
  • 9
6
votes
1 answer

1D Heat Equation using DFT produces incorrect results (FFTW)

I am trying to solve the 1D heat equation using a complex to complex IDFT. The problem is that the output after a single timestep does not seem to be correct. I have included a simple example below to illustrate the problem. I initialize the…
Naemesis
  • 139
  • 5
6
votes
3 answers

Getting the frequencies associated with STFT in Librosa

When using librosa.stft() to calculate a spectrogram, how does one get back the associated frequency values? I am not interested in generating an image as in librosa.display.specshow, but rather I want to have those values in hand. y, sr =…
rocksNwaves
  • 5,331
  • 4
  • 38
  • 77
6
votes
3 answers

How to inverse a DFT with magnitude with opencv python

I'm new to all of this, I would like to get a magnitude spectrum from an image and then rebuild the image from a modified magnitude spectrum.. But for now i'am getting a very dark reconstitution. import numpy as np import cv2 from matplotlib import…
6
votes
1 answer

Python Inverse Fourier Transform of Imaginary Odd Function

I am trying to understand how the fft and ifft functions work in python. I made a simple example of an imaginary odd function to compute the inverse Fourier transform in the hopes of getting a real odd function (as should be the case). Below is my…
Solarflare0
  • 269
  • 2
  • 5
6
votes
2 answers

Shift theorem in Discrete Fourier Transform

I'm trying to solve a problem with python+numpy in which I've some functions of type that I need to convolve with another function . In order to optimize code, I performed the fft of f and g, I multiplied them and then I performed the inverse…
nicodds
  • 83
  • 10
6
votes
1 answer

Changing the phase of a signal in frequency domain

i want to change the phase of a signal in the frequency domain. so i generated a cosine test signal to verify the code: ycheck = cos(2*pi*t); when i want to shift the phase about pi/4 i perform a fft on the signal split it in magnitude and phase…
burgo
  • 63
  • 1
  • 4
6
votes
2 answers

Fourier Transformation vs Numpy FFT

This is probably a very naive question but here it is. I want to calculate Fourier transform of a function f(x). So I define a numpy array X and pass through vectorized function f. Now if I calculate the FFT of this array f(X) it does not come out…
The Imp
  • 187
  • 1
  • 10
6
votes
2 answers

Power spectrum of an image

I have begun (a small project) to calculate the power spectrum of an image in the frequency domain. So, what I have till now is the following: %// close all; clear all; %// not generally appreciated img = imread('ajw_pic.jpg','jpg'); % it is a…
AJW
  • 5,569
  • 10
  • 44
  • 57
6
votes
2 answers

How to measure duration of different tasks in a data flow task?

I am working on optimizing a data flow task, I thought I will see which component takes how much time. I got these tasks: How should I find out how much time each took? Except time if i can find out about other resources like memory, CPU etc. that…
Pritesh
  • 1,938
  • 7
  • 32
  • 46
5
votes
1 answer

Need help understanding this line in an FFT algorithm

In my program I have a function that performs the fast Fourier transform. I know there are very good implementations freely available, but this is a learning thing so I don't want to use those. I ended up finding this comment with the following…
Verpous
  • 588
  • 3
  • 7
5
votes
1 answer

Correct normalization of discrete power spectral density in python for a real problem

I am struggling with the correct normalization of the power spectral density (and its inverse). I am given a real problem, let's say the readings of an accelerometer in the form of the power spectral density (psd) in units of Amplitude^2/Hz. I would…
Bene Gesserit
  • 51
  • 1
  • 2
5
votes
1 answer

Trying to confirm average pooling is equal to dropping high frequency Fourier coefficients using numpy

I was told that applying average pooling to a matrix M is equivalent to dropping the high frequencies components of the Fourier representation of M. With average pooling I mean 2 by 2 average pooling as visualized in this image: I wanted to verify…
dimpol
  • 545
  • 9
  • 21
1
2
3
28 29