Power Spectral Density, Welch Technique

  • Thread starter Thread starter glamotte7
  • Start date Start date
  • Tags Tags
    Density Power
Click For Summary

Discussion Overview

The discussion revolves around calculating power spectral density (PSD) from discrete data using Welch's method, specifically in the context of implementing this technique in Mathematica. Participants are exploring the theoretical underpinnings and practical coding aspects of the method, as well as comparing it to MATLAB implementations.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant seeks guidance on implementing Welch's method for PSD calculation in Mathematica, noting that MATLAB has built-in functions for this purpose.
  • Another participant questions the definition of the method being used and suggests referring to a specific equation from a paper to clarify the approach.
  • A participant expresses their unfamiliarity with digital signal processing (DSP) and seeks to understand the equation better, mentioning the importance of segmenting data and polynomial curve fitting.
  • A proposed Mathematica code snippet is shared, which translates a specific equation from the referenced paper, along with instructions on assigning constants and initializing data.
  • There is a suggestion to start with simple data examples to validate the implementation before progressing to more complex scenarios.
  • Another participant requests MATLAB code for calculating displacement PSD, indicating a broader interest in PSD calculations across different platforms.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the exact implementation details or definitions, and multiple approaches and uncertainties remain in the discussion.

Contextual Notes

Participants express varying levels of familiarity with DSP concepts, and there are indications of missing assumptions regarding the implementation of Welch's method in Mathematica. The discussion also highlights potential differences in results between MATLAB and Mathematica without resolving these discrepancies.

glamotte7
Messages
19
Reaction score
0
Hello,

Does anyone know how to calculate a power spectral density from discrete data using Welch's method with Mathematica?

Matlab readily does this but I need to do it with Mathematica.

Any guidance would be appreciated.

glamotte7
 
Physics news on Phys.org
Hello Bill,

I've carefully read the article you suggested which is not entirely, but a bit, over my head. I am new to DSP and so am trying to gain my footing. I'm sure that equation (5) of the paper you referenced would be an excellent approach. I'm not at all sure where to begin to write lines of code to accomplish this as the equation itself is a bit opaque to me. Breaking the data into overlapping segments certainly seems to be a part of the approach in the article, which is what I was expecting. Polynomial curve fitting of segments as well.

Have used the ListConvolve command in Mma and am very impressed with it's flexibility and how clear it makes convolving of the impulse response(kernal) with the data.

Guess that explains where I'm at with this. The whole problem is very intriguing and I suspect there are a number of learning points along the way. Not sure how to start though.

glamotte7
 
Here is (5) from the paper roughly translated into Mathematica.

2 DeltaT/Nw Sum[Abs[1/Sqrt[Nd]Sum[w[[n]]x[[n]]^l E^((-I 2 Pi k(n-1))/Nd)]^2, {l, 1, Nw}], {n, 1, Nd}]

To use this you need to assign appropriate constant values to DeltaT, Nw, Nd, choose and initialize a windowing function in list w, choose and initialize some plausible time domain signal list x.

Then you should probably try using you data in both Matlab and Mathematica so you can compare the results and we start the process of trying to figure out why the results are completely different, what mistakes have been made, how to fix those, etc, etc, etc.

I would start with really really simple data. A single simple sine wave that exactly fills a single segment with complete cycles is always a nice start. Then the sum of two different sine waves. Then... you get the idea. Gradually ratchet it up with multiple windows and overlapping windows and more complicated time domain data, exterminating every small error before making the next step.

If Matlab anywhere in their documentation describes exactly what they do then we might avoid some of the confusion by trying to port the Matlab method to Mathematica, rather than me just grabbing the first random page that Google showed me and asking you if this was it.
 
Bill,

OK. Thanks very much for the code. I'll try working with it as you recommended, very simple things first.

I'll check Matlab to see if they describe their approach elsewhere or what their exact code is. It didn't come up readily but maybe I can find it with more digging around.

glamotte7
 
hi
I'm looking for a MATLAB code to calculate displacement psd (power spectral density) units[m2/(cycles/m)] vs spatial frequency units[cycles/m]
Could you do me a favor and help me
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K