LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wavelet scale error.

Hi all

 

I am trying to denoise an ECG signal using discrete wavelet transform. i have done a VI for this purpose . but when wiring the ECG signal to the input of the attached VI it gives an error ( the wavelet scale must be greater than zero ).

 

can you guys have a look at my VI and see what is wrong with it ?

 

thank you .

Bill David
Download All
0 Kudos
Message 1 of 6
(2,475 Views)

Hi Bill!

 

 I've checked the VI you've supplied, but for me it runs perfectly well. The error you've descibed seems to suggest that the VI doing the DWT is unable to set the appropriate scale levels for the dataset provided. Please try testing it by manually setting the levels input of the DWT to an integer no greater than log2(Ld), where Ld is the length of your dataset.

 

I'd also suggest trying DWT and IDWT without any additional modification of the signal, to see if we can get the original back without issue, and start from there.

 

And finally, please check if the inputs to this subVI are all valid like the default values you've set.

 

Hope this helps, we'll look for other solutions if it does not. 

 

Kind regards:

 

Andrew Valko

National Instruments AE

Andrew Valko
National Instruments Hungary
0 Kudos
Message 2 of 6
(2,458 Views)

Hi Valkoa

 

thak you for the reply . let me tell things .

 

well if you try to run the VI itself it works fine . BUT all what i am doing is to supply a signal to the VI (ECG data denoise ) and it gives me an error . the attached VI'S shows you the type of a signal that i am suplying to the wavelet VI . it is an ECG signal that i am acquiring from the serial port . when connecting the ECG signal to the VI it just gives me an error saying the source is empty . 

 

can you suggest anything please ?

 

thank you .

Bill David
Download All
0 Kudos
Message 3 of 6
(2,455 Views)

Dear Bill!

 

I've checked your architecture, but I do not see any problems whatsoever with it. I'm not sure where you're doing the wavelet filtering though, since that VI is not on the Block Diagram. You can see the original captured data on the graph, correct?

 

If that is the case, all you have to do to make sure that the wavelet subVI receives valid data at every iteration. The simplest way of doing this is to just check if the incoming data array is empty, and skipping the subVI call if it is. You can even perform similar checks with other inputs, just to make sure that all of them receive valid data.

 

Let me know if this helps.

 

Kind regards:

 

Andrew Valko

National Instruments AE 

 

Andrew Valko
National Instruments Hungary
0 Kudos
Message 4 of 6
(2,447 Views)

Dear Valkoa 

 

Thank you very much for your support . YES it was all because the wavelet VI was receiving an empty signal . now everything is working fine . thank you . 

 

One more thing , Well, as we all know that we use wavelets in order to suppress frequencies that are not in the band of intersts. what do you suggest if I am obtaining 40% of the results . i mean it filters out the unwanted frequencies 40% .

 

what do you suggest if i want the wavelet denoiser to be much efficient .

 

 

AGAIN thank you for your care 

 

 

Bill David
0 Kudos
Message 5 of 6
(2,445 Views)

Dear Bill!

 

 That is quite a loaded question. Filter design is a whole science by itself, and I don't believe that a non-trivial solution exists in your case.

 

What is my desired noise-to signal ratio? What manner of noise do I have? What is an acceptable degradation of signal accuracy (peaks and transients)? 

 

These are all questions that you most consider, and then shoot for an optimal compromise.

 

I would say the easiest solution would be to try and set different thresholds, manual settings and constants, and check the output signal to see what works best for you. Also, keep in mind that the main advantage of wavelet filters is that the can keep sharp edges and transitions while maintaining good noise reduction. Because of this special treatment of meaningful edges, noise that is next to an edge will not be filtered well.

 

You can even use more then one filter to target specific frequency areas and problems.

 

Please check this whitepaper for more details of ECG signal filtering. There is also quite exellent academic literature on tre subject, for instance here or here.

 

Kind regards:

 

Andrew Valko

National Instruments AE

 

Andrew Valko
National Instruments Hungary
0 Kudos
Message 6 of 6
(2,428 Views)