All Questions
44 questions
0
votes
1
answer
152
views
FFT of rectangular pulses in python
I am working on an assignment to convert a Matlab script to fft a rectangular pulse to python. However, the output in python is unexpectedly a straight horizontal line.
The original script performs ...
2
votes
1
answer
73
views
FFT values computed using Python and MATLAB don't match?
I have a super simple test code to compute FFT in MATLAB, which I am trying to convert to Python but the computed values do not match.
MATLAB Code:
rect=zeros(100,1);
ffrect=zeros(100,1);
for j=45:55
...
1
vote
0
answers
99
views
Problem translating simple Matlab function to Python: ifft results are different
I am trying to translate to Python a Matlab function that calculates the Stockwell Transform for a time serie. The function ("stran") is taken from FileExchange: https://ch.mathworks.com/...
1
vote
0
answers
27
views
FFT sound analysis yields the correct note but in another octave [duplicate]
I've been working on a python app that displays in order each note that is played in an audio file. I do this as follows: I split the audio samples into onsets, I run fft on each onset and get the ...
1
vote
1
answer
515
views
Why is the result of numpy fft different from matlab fft?
I was using parameters and formulations below to generate signals.
python code:
import numpy as np
fs=15e6
dt=1/fs
f0=1e6
pri=400e-6
t=np.arange(0,pri,dt)
i=64
fd=5/(i*pri)
xt=0.1*np.exp(2j*np.pi*f0*...
0
votes
1
answer
175
views
different calculation output from Matlab and Python for Inverse Fourier Transform
I have Matlab code and I want to translate it into Python.
here I have an array
python array
import numpy as np
a = [ 81.42663125 -5.6074337j, -26.39236508 -2.20896985j, 0.+0.j, 0.+0.j, 0.+0.j, ...
-1
votes
2
answers
532
views
Wrong ifft in numpy
I have this bidimensional array called a:
[2.1814 + 0.0000i 1.1375 + 0.0000i 0.2506 + 0.0000i 0.2506 + 0.0000i 1.1375 + 0.0000i]
[-2.1719 + 0.2033i -1.1326 + 0.1060i -0.2496 + 0.0234i -0....
1
vote
1
answer
899
views
"pspectrum" function in python
I have used 'pspectrum' in MATLAB and I must admit that it is a very powerful function that yields in a very neat power spectrum. Below shows the the power spectrum once plotted using 'pspectrum' and ...
0
votes
1
answer
353
views
How can I get same results for fft2() in MATLAB and Python?
I am translating a MATLAB code to Python code but I get different results from numpy fft2() and MATLAB fft2(). Difference is not small. How can I get same result?
Where S is (10,10,3) array
In Python:
...
1
vote
1
answer
214
views
Python or Matlab: synchronized audio playback with data visualization (waveform/STFT-spectrogram etc.)
I want to do a python or matlab project which visualizes audio data while being synchronized with playback.
In details, it means in a GUI, I have two main regions, one for data visulization and the ...
1
vote
0
answers
65
views
Unable to produce the same result in python porting from matlab
I am stuck again with this issue of not able to produce the same result in Python using numpy compared to Matlab output. I am hoping that the ported code is exactly the same in terms of what it does ...
2
votes
2
answers
3k
views
Differences between MATLAB and Numpy/Scipy FFT
EDIT:
As it turns out this is still a question of floating point rounding error like others. The asymmetry in fft vs ifft absolute error comes from the difference in the magnitudes of the numbers (...
0
votes
1
answer
330
views
FFT result in python is different than in matlab with the same matrix
I'm trying to convert matlab code into python. It loads .mat files and plot it into python. Handling the struct in python has been quite hard and I'm still trying to get the hang of it.
When trying ...
0
votes
0
answers
392
views
Python: Obtaining Correct Phase Spectrum Without Noise
I am trying to get the 30 degree phase shift @50 Hz to be shown.
Below is the code that I used:
import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import fft,ifft,fftshift
pi = ...
0
votes
0
answers
187
views
Matlab fft() in python
What is the python equivalent to Matlab:
Y = fft(X,n,dim)
Where X is a 64x64 complex double matrix, n = 64, and dim=1
I tried using numpy.fft.fft() however it does not give me the correct results