fft

Computing mean square displacement using python and FFT

∥☆過路亽.° 提交于 2019-12-21 20:24:00
问题 Given a 2 dimensional array, where each row represents the position vector of a particle, how do I compute the mean square displacement efficiently (using FFT)? The mean square displacement is defined as where r(m) is the position vector of row m, and N is the number of rows. 回答1: The following straight forward method for the msd works, but it is O(N**2) (I adapted the code from this stackoverflow answer by user morningsun) def msd_straight_forward(r): shifts = np.arange(len(r)) msds = np

Delay a signal in time domain with a phase change in the frequency domain after FFT

丶灬走出姿态 提交于 2019-12-21 19:58:31
问题 I have a problem with a basic time/frequency property implemented in a Matlab script. The property is: I've tried to implement this in a Matlab script. I've supposed a sinusoidal signal with 5Hz of frequency value, Sampling frequency equal to 800Hz and I want to delay this signal by 1.8 seconds. So I've implemented this script: Fs = 800; Time_max = 4; % seconds t = 0:(1/Fs):Time_max; delay = 1.8; % One second of delay f = 5; %Hz y = sin(2 * pi * f * t); figure subplot(2,1,1) plot(t,y); xlabel

How to extract a specific frequency range from a .wav file?

跟風遠走 提交于 2019-12-21 18:05:33
问题 I'm really new on sound processing, so maybe my question will be trivial. What I want to do is to extract a specific frequency range (let's say 150-400 Hz) from a wav file, using R. In other words, I want to create another wave file (wave2) that contains only the frequency component that I specify (150 to 400 Hz, or what else). I read something on the net, and I discovered out that this can be done with a FFT analysis, and here's come the problems. Suppose I've this code: library(sound) s1 <-

FFT on image with Python

£可爱£侵袭症+ 提交于 2019-12-21 10:18:04
问题 I have a problem with FFT implementation in Python. I have completely strange results. Ok so, I want to open image, get value of every pixel in RGB, then I need to use fft on it, and convert to image again. My steps: 1) I'm opening image with PIL library in Python like this from PIL import Image im = Image.open("test.png") 2) I'm getting pixels pixels = list(im.getdata()) 3) I'm seperate every pixel to r,g,b values for x in range(width): for y in range(height): r,g,b = pixels[x*width+y] red[x

What are the downsides of convolution by FFT compared to realspace convolution?

老子叫甜甜 提交于 2019-12-21 06:58:00
问题 So I am aware that a convolution by FFT has a lower computational complexity than a convolution in real space. But what are the downsides of an FFT convolution? Does the kernel size always have to match the image size, or are there functions that take care of this, for example in pythons numpy and scipy packages? And what about anti-aliasing effects? 回答1: FFT convolutions are based on the convolution theorem, which states that givem two functions f and g , if Fd() and Fi() denote the direct

Android - AudioRecord class does not read data, audioData and fftArray return zero

ε祈祈猫儿з 提交于 2019-12-21 06:41:24
问题 I am new to android and I have been working on a Pitch Analyzer application (minimum SDK: 8). I read many articles on how to implement Audiorecord class but I wonder why it does not read any data when I record. I tried to display the values of the audioData and fftArray but zero is returned, so I assumed the problem is with the read method. Please try to check these. Here are the codes I used: FFT.java Complex.java record.java final Intent intent = new Intent("pitch.analyzer.PitZer.ASSESSMENT

Android - AudioRecord class does not read data, audioData and fftArray return zero

╄→гoц情女王★ 提交于 2019-12-21 06:41:00
问题 I am new to android and I have been working on a Pitch Analyzer application (minimum SDK: 8). I read many articles on how to implement Audiorecord class but I wonder why it does not read any data when I record. I tried to display the values of the audioData and fftArray but zero is returned, so I assumed the problem is with the read method. Please try to check these. Here are the codes I used: FFT.java Complex.java record.java final Intent intent = new Intent("pitch.analyzer.PitZer.ASSESSMENT

Performing a phase correlation with fft in R

痞子三分冷 提交于 2019-12-21 05:47:09
问题 I am trying to implement a 2d phase correlation algorithm in R using a recipe from Wikipedia (http://en.wikipedia.org/wiki/Phase_correlation) in order to track the movement between 2 images. These images (frames) were captured with a camera shaking in the wind and the ultimate goal is to remove the shake in these and subsequent frames. The two example images and the R code are below: ## we will need the tiff library library(tiff) ## read in the tiff files f1=as.matrix(readTIFF('f1.tiff'

Fast Fourier transformation in Java [duplicate]

我与影子孤独终老i 提交于 2019-12-21 05:23:06
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Reliable and fast FFT in Java i want to implement a fast fourier transformation calculation in java. Is there any library in java to do calculation in fourier transform and i also want to know about the audio libraries in java. 回答1: May be a duplicate, but you're probably going to have a challenge making a JNI/NDK setup work. Consider a full java solution with JTransforms 来源: https://stackoverflow.com/questions

Recreating time series data using FFT results without using ifft

我的梦境 提交于 2019-12-21 05:05:13
问题 I analyzed the sunspots.dat data (below) using fft which is a classic example in this area. I obtained results from fft in real and imaginery parts. Then I tried to use these coefficients (first 20) to recreate the data following the formula for Fourier transform. Thinking real parts correspond to a_n and imaginery to b_n, I have import numpy as np from scipy import * from matplotlib import pyplot as gplt from scipy import fftpack def f(Y,x): total = 0 for i in range(20): total += Y.real[i]