fourier series - Spectrum of Cosine in Complex Form

The complex exponential form of cosine$$\cos(k \omega t) = \tfrac{1}{2} e^{i k \omega t} + \tfrac{1}{2} e^{-i k \omega t}$$The trigonometric spectrum of $\cos(k \omega t)$ is single amplitude of the cosine function at a single frequency of $k$ on the real axis which is using the basis function of cosine?The complex exponential spectrum of $\cos(k \omega t)$ has two amplitudes at 1/2, one at $k$ and $-k$.I am confused what this x-axis is representing - amplitudes of what? Whats the basis function? I'm guessing amplitudes of exponential but thes...Read more

frequency spectrum - Why so many methods of computing PSD?

Welch's method has been my go-to algorithm for computing power spectral density (PSD) of evenly-sampled timeseries. I noticed that there are many other methods for computing PSD. For example, in Matlab I see:PSD using Burg methodPSD using covariance methodPSD using periodogramPSD using modified covariance methodPSD using multitaper method (MTM)PSD using Welch's methodPSD using Yule-Walker AR methodSpectrogram using short-time Fourier transformSpectral estimationWhat are the advantages of these various methods? As a practical question, when w...Read more

Convolution in the frequency domain

We often hear that "convolution in time is the same as multiplication in frequency", and vice versa, that "convolution in frequency is the same as multiplication in time". So in a typical windowing operation, we do a point-wise multiplication of a signal $x[n]$, with a window $w[n]$. This means that in the frequency domain, we are performing $X(f) * W(f)$. My question is the following: I wish to illustrate this for myself, but I am not sure what lengths FFTs to take, and what type of convolution to do. (Circular? Linear? etc). Those details see...Read more

Estimating the amplitude of a particular frequency

I am relatively new to DSP and have been reading a lot on the internet. I have a couple of questions.I have a signal in the form of a function $$f(x) = A_0 + A_1 \cos(\omega_1 x) + A_2 \cos(\omega_2 x)+...+ A_n \cos(\omega_n x). $$I have $f(x)$ and I know the minimum and maximum frequencies. $f(x)$ can have really high frequencies. a) I need to find the amplitude $A_p$ of a particular frequency $\omega_p$ in $f(x)$. One way to do this is, I could get sample points from $f(x)$ sampling at greater than Nyquist rate and do an FFT and find the ampl...Read more

frequency spectrum - How can I accurately represent an mp3's wave form in respects to time?

I'm trying to programmatically plot a sound wave that I have placed in a 2d array, however, I cannot consistently get the sound wave to reach the end of the window. For example, when you load a sound in audacity, you get this:In contrast, when I load a sound into my program I will often get something like this (red is the play head that moves at speed of one blue tick mark every second. The Green line is the end of the song in seconds):As you can see, I can plot the complete wave form, but it does not sync up with the end of the song. Oddly eno...Read more

frequency spectrum - Should the phase coefficients of the DFT of a real, even input signal all be zero?

The phase coefficients of a real, even input signals should all apparently be $0$ or a multiple of $\pi$. That's a property of the DFT I've learned about in the Audio Signal processing course on coursera. However, the example they use completely confuses me.They create a triangle wave that looks like this:and then showed the phase spectrum to be this:They explained that this phase spectrum was not zero, because the original triangle function wasn't even because it wasn't centered around zero - it had a phase shift that was messing things up. So...Read more

dBFS scaling and spectrum

I am trying to replicate the spetrum as given in Audacity and other commercial software... I am getting crazy with the correct scaling needed in order to have dBFS (with reference to a full scale sine wave).Suppose $x_t$ is the PCM sample at $k$ bit precision, first of all I rescale the PCM samples$$s_t = \frac{x_t}{ \frac{ 2^{k-1} }{ \sqrt{2} } }$$Suppose now $w_t$ is some window function, I compute the FFT of of size N of the product $s_t w_t$. Let $P_1, P_2, \ldots, P_N$ be the FFT complex values. Since I am only interested in one-side s...Read more

frequency spectrum - Difference between PSD estimate and variance of DFT

In Bartlett's PSD estimate one averages over L segments of the squared DFT coefficients. From wikipedia I found this formula$$ \textrm{PSD}(k) = \frac{1}{L}\sum_{l=1}^{L} \frac{1}{M} \lvert X^{[l]}(k)\rvert^2 \tag{1}$$where $X^{[l]}$ denotes the DFT of the $l^{\rm th}$ segment.With my (not so standard) DFT Definition$$X(k) = \frac{1}{\sqrt{N}} \sum_{n=1}^{N}x[n]e^{-j\omega_kn}, \textrm{with } \omega_k = \frac{2\pi k}{N} \tag{2}$$Bartlett's method results in$$\textrm{PSD}(k) = \frac{1}{L}\sum_{l=1}^{L} \frac{1}{M} \lvert\sqrt{M}\cdot X^{[l]}(k)...Read more

frequency spectrum - In the formula for the windowed Fourier transform, why is the complex-exponential term not time-shifted to the position of the window?

I have a question about the "windowed / short-time / short-term" Fourier transform that is somewhat perplexing me. I have now added an Addendum at the bottom, where the issue is presented more concisely through an example.$ $Idea of the Fourier transformGiven a "nice" function $f \colon \mathbb{R} \to \mathbb{R}$, we define the Fourier transform $\hat{f} \colon \mathbb{R} \to \mathbb{C}$ of $f$ by$$ \hat{f}(\xi) \ = \ \int_{-\infty}^\infty f(\tau)e^{-2\pi i \xi\tau} \, d\tau. $$If we write $\hat{f}(\xi)=A_\xi e^{i\phi_\xi}$ for each $\xi > 0...Read more

Spectrogram, time vs frequency localization, and length of signal

So I'm having some trouble conceptually and am hoping somebody can clear something up for me. This is long and I apologize for that but I want to provide as much information as possible so that the source of my confusion might be exposed.I have a signal with a sampling rate of $74767 { samples \over sec}$. I want to take the spectrogram in matlab of this signal but I'm really only interested in the content in the first $1\over2$ second. Now, if I throw out everything after 0.5 seconds and attempt to compute the spectrogram using the time-freque...Read more

Identify the frequency spectrum of an audio file by using matlab

I need to identify the first few harmonics of a audio file by cancelling the noise of the specific signal.So I have partitioned the signal into 1024 Hz sample blocks and then took the FFT values of each block separately and finally add all FFT values and plot the waveform. Here is my matlab code. Somebody help me with the code since i cannot add the first block fft into total fft. Get an error. Please somebody help meclcclear[signal,fs] =audioread('Female_55.wav'); %Only for plotting t=0:1/fs:(length(signal)-1)/fs; %Only for plottingfs...Read more

frequency spectrum - Why is there a mismatch between normalized cross-correlation and perception for basic waveforms?

To my ears, sawtooth and square waves are more similar to each other than either one is to a triangle wave. However, when I compare their magnitude spectra against each other using normalized cross-correlation, the square and triangle waves are the most similar to each other, followed by the sawtooth and triangle waves. Does anyone know what the source of this apparent mismatch is?...Read more

frequency spectrum - Nyquist Plot for transfer functions with poles at the origin

I'm learning Nyquist plots and something has been seriously bugging me when treating poles or zeros in the origin. Nyquist plots obtains information based on the argument principle which states"If f(z) is a meromorphic function inside and on some closed contour C, and f has no zeros or poles on C, then$${\displaystyle \oint _{C}{f'(z) \over f(z)}\,dz=2\pi i(N-P)} \oint_{C} {f'(z) \over f(z)}\, dz=2\pi i (N-P)$$where N and P denote respectively the number of zeros and poles of f(z) inside the contour C, with each zero and pole counted as many ti...Read more