LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract periodic behavior for STL Algorithm

Solved!
Go to solution

Hello you all,

 

I am currently working on a decomposition Algorithm to extract its components (Trend, Seasonality, Residue). Getting the trend was fairly easy, however I'm having some troubles extraction the seasonality. I am aware that a fourier transformation might help me. However I need the phase + periodicity, is there any VI that does just that? I should add, that I'm working with arrays instead of an actual signal. I don't know if that is smart, but that's simply the way I am currently comfortable working with. I would appreciate some tips and tricks.

 

Thank you!

0 Kudos
Message 1 of 5
(760 Views)

If you have a signal consisting of N measurements equally spaced in time (call the interval "dt"), so the total time T of the signal is N * dt, then Fourier Analysis can decompose this signal into a DC component, (N/2 - 1) frequency components (with the lowest frequency 1/T, and the others integer multiples of this up to (N-1)/(2*T), and a "noise" term.  If N, the number of measurements, is a power of 2 (such as 1024 samples), there is an especially efficient (and "fast") algorithm called the Fast Fourier Transform (or FFT) that can return Gains and Phases very quickly.

 

So with a signal having N equally-spaced points (try to make N a power of 2!), finding the "periodicity", assuming the signal consists of a single frequency sinusoid + "noise" components at the other frequencies, is equivalent to doing an FFT and asking for the frequency component with the highest Amplitude (or "gain").  If it's the 23rd harmonic, and your period is 102.4 seconds and your sample size is 1024, then the lowest harmonic is 1/102.4 and the 23rd harmonic is 23/102.4 = 0.225 Hz.  The phase is the phase of this component.

 

You can find LabVIEW functions for analyzing sampled data (LabVIEW calls them "Waveforms") in the Waveform Palette.  Look under Analog Wfm, then Measurements sub-Palettes.

 

Bob Schor

0 Kudos
Message 2 of 5
(723 Views)
Solution
Accepted by topic author mikoborn

There is a ready made vi called extract single tone information (found under signal processing/ wfrm measure/...)

if your array is equally sampled you can use the build wfrm vi to feed it

 

array to extract tone.png

see help files .. it will also provide you with the residuals 😉

 

If your array is not sampled with constant dt, you can use a 4 parameter sine fit ( you need to programm yourself.. use it as a search term .. ) however you also need to provide an array of the sample timestamps ... and you need a coarse guess for the frequency as a starting value

 

or you try a model of your signal and feed it into the lev-maquard fit ...

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 5
(704 Views)

Thank you Henrik,

 

that is exactly what I was looking for. The next step would be extracting multiple waveforms and its components. I added two waveforms witg different characteristics and tried extracting them again. I tried using the "get single tone information" vi to get the characteristics of one of the waveforms. However obviously the vi mixes the characteristics of the different waveforms up. Is there any way to fix this?

 

 

Greetings from Germany 🙂

 

mikoborn

0 Kudos
Message 4 of 5
(660 Views)

Forgive me for asking stupid questions. Just found the extract multiple tone information vi lol.

0 Kudos
Message 5 of 5
(652 Views)