fft

Hilbert Transform (Analytical Signal) using Apple's Accelerate Framework?

爱⌒轻易说出口 提交于 2019-12-24 04:11:17
问题 I am having issues with getting a Matlab equivalent Hilbert transform in C++ with using Apple's Accelerate Framework . I have been able to get vDSP's FFT algorithm working and, with the help of Paul R's post, have managed to get the same outcome as Matlab. I have read both: this stackoverflow question by Jordan and have read the Matlab algorithm (under the 'Algorithms' sub-heading). To sum the algorithm up in 3 stages: Take forward FFT of input. Zero reflection frequencies and double

matplotlib imshow editing x-axis

烂漫一生 提交于 2019-12-24 02:44:11
问题 I want to display an amplitude spectrum of an image. I am able to do this using following code: import numpy as np import matplotlib.pyplot as plt import pylab pylab.gray() pic = pylab.imread("C:/pic.png")[::-1,:] amp_pic = pylab.subplot(1,4,1) amp_pic.xaxis.set_ticks_position('top') pylab.imshow(np.abs(np.fft.fftshift(np.fft.fft2(pic))),\ interpolation='nearest') pylab.show() But the axis is not labeled the way an amplitude spectrum should be labeled. In the case of a 1D-function the

matplotlib imshow editing x-axis

倖福魔咒の 提交于 2019-12-24 02:44:07
问题 I want to display an amplitude spectrum of an image. I am able to do this using following code: import numpy as np import matplotlib.pyplot as plt import pylab pylab.gray() pic = pylab.imread("C:/pic.png")[::-1,:] amp_pic = pylab.subplot(1,4,1) amp_pic.xaxis.set_ticks_position('top') pylab.imshow(np.abs(np.fft.fftshift(np.fft.fft2(pic))),\ interpolation='nearest') pylab.show() But the axis is not labeled the way an amplitude spectrum should be labeled. In the case of a 1D-function the

Scaling problems with IFFT in Matlab

▼魔方 西西 提交于 2019-12-24 02:39:08
问题 I'm studying the IFFT in Matlab by applying it to a Gaussian. According to Wikipedia tables, the Fourier transform pair would be F(w) = sqrt(pi/a) * exp(-w^2/(4a)) in frequency, and f(t) = exp(-at^2) in time. I modified the code in a previous question plus Cris Luengo's answer to perform this IFFT. a = 0.333; ts = 1e4; % time sampling L = 1000*ts; % no. sample points ds = 1/ts; f = -floor(L/2):floor((L-1)/2); % freq vector f = f/ts; w = 2*pi*f; % angular freq Y = sqrt(pi/a)*exp(-w.^2/(4*a));

Proving Fourier transform operation in Python

99封情书 提交于 2019-12-24 02:09:08
问题 I have an expression in the time domain f = -1j*H(t) * exp(-(1j*a+b)*t) which can be Fourier transformed analytically using known properties ( H is the Heaviside step function). The result of this FT operation is F = (w-a-1j*b)/((w-a)**2+b**2) where w is frequency. Now I'm using the tips in this article to do numerical Fourier transform on f in Python, and confirm that I do get the same analytical result F : import numpy as np import matplotlib.pyplot as plt t = np.linspace(-10,10,1e4) # time

How to downsample Fourier complex values?

可紊 提交于 2019-12-24 01:38:28
问题 Disclaimer: I'm not a signal processing expert. I'm writing a function that takes a 1D array and performs Fast Fourier Transform on it. Here's how it works: If the array's size is not a power of two, pad it with 0s at the end so that its size becomes a power of two. Perform FFT on the padded array and store the results in an array x . Downsample the complex array x to match the length of the original non-padded array. Return x . I'm having trouble with step 3 . If I omit step 3 and perform

Reading out specific points off the Matlab / Octave fft2() function output

不问归期 提交于 2019-12-24 00:38:44
问题 I am getting familiarized with Octave and the function fft2() . In this toy example, I am aiming at producing the 2D DFT of the following 256 x 256 png image: To be able to understand the output easily, I try to convert this image into a 256 x 256 image, eliminating color information: Im = imread('circ.png'); pkg load image Im = rgb2gray(Im); figure, imshow(Im) After this bookkeeping preliminaries I run: A = fft2(double(Im)); OK. Now I take the same image, and analyze it with ImageJ, checking

Inverse FFT returns negative values when it should not

旧城冷巷雨未停 提交于 2019-12-24 00:09:10
问题 I have several points (x,y,z coordinates) in a 3D box with associated masses. I want to draw an histogram of the mass-density that is found in spheres of a given radius R . I have written a code that, providing I did not make any errors which I think I may have, works in the following way: My "real" data is something huge thus I wrote a little code to generate non overlapping points randomly with arbitrary mass in a box. I compute a 3D histogram (weighted by mass) with a binning about 10

right way of performing inverse FFT in MATLAB?

纵饮孤独 提交于 2019-12-23 22:04:22
问题 I've red through the matlabcentral discussion on fftshift and ifftshift but I don't understand completely what's the right thing to do for me. A bit more helpful for one aspect is this answer on stackoverflow. I have an array A with (equally-spaced) angular frequencies in the first column and the corresponding intensities in the second column. It has an arbitrary length (can be odd or even). It does not start with zero frequency, but essentially, I am interested in a time-shift tau of an

数字信号处理实验(MATLAB)

假如想象 提交于 2019-12-23 21:42:36
1.语音信号处理 利用windous下的录音机或其他软件录制一段自己的语音(规定:语音内容为自己的名字,以wav格式保存,如wql.wav),时间控制再2秒之内,利用MATLAB提供的函数wavread(Matlab7.0版本,高版本采用audioread函数读取音频文件)对语音信号进行采样,提供sound函数对语音信号进行回放。 [y,fs,nbits]=wavread(file), 采样值放在向量y中,fs表示采样频率,nbits表示采样位数。Wavread的更多用法请使用help命令自行查询。 2)语音信号的频谱分析 利用fft函数对信号进行频谱分析 3)受白噪声干扰的语音信号的产生与频谱分析 ①白噪声的产生: N1=sqrt(方差值)×randn(语音数据长度,2)(其中2表示2列,是由于双声道的原因) 然后根据语音信号的频谱范围让白噪声信号通过一个带通滤波器得到一个带限的白噪声信号N2; 带通滤波器的冲激响应为: hB(n)= 其中ωc1为通带滤波器的下截止频率,ωc2为通带滤波器的上截止频率。其中下截止频率由每个人的语音信号的最高频率确定 滤波器的长度N由滤波器的过渡带确定,一般不宜太小(大于1000),α=(N-1)/2; ②信号y通过低通滤波器,得到信号为x1 低通滤波器的冲激响应为: 其中的ωc1与上面的带通滤波器的下截止频率一致