LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

power of a frequency domain signal + slow execution of plotting a signal with different colour

Hello everyone,

 

I am measuring pulse rate to analyse HRV. I am at a stage where I have a time domain signal which I convert to frequenct domain to measure Power Spectral DEnsity and power in specific freuency range.

I have split the frequency domain signal (0 - 0.5 Hz) into three components 0 - 0.04 Hz, 0.04 -0.15Hz and 0.15 to 0.4Hz

I now need to calculate power of these signals and not sure which VI to use.

Also when I plot these three signals to give the overall signal with different colours (has been discussed in a number of posts earlier), this slows my execution and I cant affordit as I am analysing real time.

 

The way I have done this is-

Take the signal components from an array (by specifying index and length)

Insert these into an array where other than interested range, the rest is NaN

Create a waveform of these three components

Merge waveforms to one plot 

 

How shall I make this execution faster?

 

 

0 Kudos
Message 1 of 4
(2,550 Views)

Hi,

 

The poor performance is more likely caused by how you build your array and loop structures. The colouring effect on your graph isn't really computational intensive.

 

There are many different ways to measure the power. For example, you can use "Amplitude and Level Measurements" express VI to quickly measure the RMS and peaks.

Message Edited by Mark M on 03-11-2009 01:37 PM
Best regards,

Mark M.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 4
(2,524 Views)

Thanks Mark,

 

I have attached a snapshot of the bit of code that does the above. Could you help me point what I can do to make the execution faster?

0 Kudos
Message 3 of 4
(2,514 Views)

Hi,

 

I can see your code is generating a lot of unnecessary copies of the same array, hence there are a lot of memory read/write opeartion that slows down the execution.

 

You may want to optimise your code and take the advantage of using "Inplace" algorithms. A good point to start learning how to use "inplace" is from this presentation: Improving the Performance of Your LabVIEW Applications.

 

I hope this helps,

Best regards,

Mark M.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 4
(2,504 Views)