| Author |
Message |
snovotill
Joined: Feb 8, 2013 Posts: 80
|
Posted: Nov 10, 2013 10:29 AM Post subject: VectorToScalar to calculate power in frequency band. |
|
Hola, I'm experimenting with FFT>Subvector>VectorToScalar for measuring band power, and so I fired up a 10Hz 28uVp-p sinewave in SimSource -> ScalarTimeTransform(RMS) -> NumericDisplay, and I get a reading of 9.5uV RMS, although I was expecting 9.9uV.
Confidence up, I then patched the SimSource -> FFT -> VectorToScalar(RMS) -> NumericDisplay, and this time I get a reading of 183 whereas I was expecting 9.9 again. I then tried SumOfSquares and got a huge number, yet this dataset contains one little spectral peak at 10Hz.
In the end I'm trying to measure power in various frequency bands. Not sure where to look next, who to ask for, or what to see, so would appreciate a tip or small square of chocolate. Thanks |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1073
|
Posted: Nov 10, 2013 7:40 PM Post subject: |
|
See this snippet, the RMS value is 9.9 as you expected.
http://proatech.com/design/rms_snippet.bpd
The RMS out of VectorToScalar element will not give the same result. It calculates RMS of vector bins.
If you use operations on VECTORS, use the float elements only (not scalars). Scaling is fully implemented only for one dimensional stream scalar elements. |
|
 |
snovotill
Joined: Feb 8, 2013 Posts: 80
|
Posted: Nov 11, 2013 4:57 AM Post subject: |
|
There doesn't seem to be any BioEra element to transform VectorToFloat, which is why I used the RMS function in VectorToScalar instead. Does that not give me the RMS of Sine&Cos elements of the bins, via some kind of sum of squares algorithm or similar? Of course if the RMS calculation works primarily across bins rather than across time, then I'll need an intermediate transform prior to running Average or SumOfSquares etc. A bit of clarification could be useful. |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1073
|
Posted: Nov 11, 2013 5:54 AM Post subject: |
|
Yes, VectorToScalar but select float option.
Vector elements do not know about sines or cosines. They are not only for FFT processing. Vector is simply an array of values. And RMS (and all other functions) calculate it for all those values in that array. |
|
 |
snovotill
Joined: Feb 8, 2013 Posts: 80
|
Posted: Nov 11, 2013 6:24 AM Post subject: |
|
Aha! I thought it was much more complicated than that.
The GOOD NEWS is that FFT-vector feeding into VectorToScalar does yield fairly close results now that I know how these work, and I can always do a full vector-to-vector preprocessing.
Thanks again for success.
There is a lingering question: I can't find an element which transforms an FFT-vector into simple Float out via Average, RMS, Peak etc... and I'd rather not use the FFT-floatvector block due to processing overhead. Is this planned? |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1073
|
Posted: Nov 11, 2013 6:29 AM Post subject: |
|
| I don't think I understand. The VectorToScalar does that, doesn't it? And what processing overhead? |
|
 |
snovotill
Joined: Feb 8, 2013 Posts: 80
|
Posted: Nov 11, 2013 7:07 AM Post subject: |
|
No such luck. VectorToScalar only comes with a Scalar (yellow) output. Maybe because the incoming vectors consist of Scalar values.
The processing overhead I'm referring to FFT. According to the manual, using Float for FFT doubles the CPU useage, which is why I'd rather stay away from FloatVector. |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1073
|
Posted: Nov 11, 2013 7:19 AM Post subject: |
|
You need to select FLOATVECTOR option, not FLOAT. It does come with float output.
I wouldn't worry about performance difference between integer and float FFT. Yes, they may be twice slower, but it doesn't mean you will notice any difference. |
|
 |
snovotill
Joined: Feb 8, 2013 Posts: 80
|
Posted: Nov 11, 2013 7:39 AM Post subject: |
|
| That does work if I also use Float-FFT. Thanks. I'll give it a shot and if I have performance issues I'll go see my doctor. |
|