Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

amplitude of a periodic signal

Hello fellas now i have another novice problem, looks as if i had 2+2 and it equals 4 and then i change it to 2+3 and it freaks me out cause it equals 7. and i dont. know. why? 😄

 

so heres the problem: i am acquiring a signal which changes periodically and i want to measure the amplitude sticking to the frame method - i get the block of samples and then analise it with peak/valley thing, substract peak from valley and get the amplitude withing this sample range.

 

in order to come up with a scheme, i built the attached vi, which generates the signal, adds noise and then i measure the amplitude with peak/valley thing. now the problem i face is that the chart stops showing the amplitude value at certain signal freq and noise freq. should i change any of them to another value, the chart goes on showing stuff, which is most likely nothing close to the real amplitude which i can see on the chart showing the initial signal+noise. for instance, if i see with my eyes that the amplitude should be around 10, the chart shows eather nothing as if it stopped or nothing correct. 

If you could give me any advice on this, id much appreciate your help, thanks! 

p.s. i have a different .vi for my test rig which is supposed to measure the amplitude of a signal from pressure sensors, all these extract single tone/multiple tone ifo, amplitude and level.vi and stuff like that and nothing works with any treshold 😞 and now i hope this peak/valley method works, but i still dont understand why it shows what it shows 

______________________________________
i've got a rebel heart
0 Kudos
Message 1 of 17
(4,718 Views)

Some points to get started.

 

1. The sequence structure is unnecessary. It makes no difference to the way the program runs. Remove it.

2. The length input to Extract Portion of Signals.vi is 500 but the length of the signal is 1. Setting that input to 0.5 gets half of the  data.

3. The width input to the peak detector is in units of samples. With a setting of 500 it looks for a peak 500 samples wide. With that setting the output of the peak detector is almost always an empty array. Put an indicator on the output wire and watch. Also put an indicator on the # found output and watch it stay zero.  

3.a. Widths of 14 t0 48 samples seemed to give me 5 peaks with 5 cycles of the waveform (500 samples) going into the peak detector. This was with amplitude = 1 and noise = 0.1.

4. Since the peak detector has array inputs it might be simpler (and easier to understand) if you just put Get Waveform Components followed by Array Subset to get the data you want to send to the peak detectors. Express VIs (and the Dynamic Data Type they insist on generating as outputs) tend to obscure what is going on. I try to avoid them.

 

Lynn

 

Simplified extraction.png

0 Kudos
Message 2 of 17
(4,703 Views)

Do you have any real signal ?

Can you tell us more about the physics behind? What do you need to measure?

Max stress , energy, amplitude peaks, ... ?

Bandwitdth of your signal, how fast is it changing amplitude , how fast do you need to measure it?

 

Still think that some kind of filter / fitting will do the job,   maybe a adaptive Savitzky-Golay ?  or a simple low pass?

 

 

Signal processing is huge toolbox 🙂 but it's not always simple to pick the right tool 😉

Spoiler
And a bad worksman always blame his tools 😄 😄
Spoiler
EDIT: Please don't take that personal, I don't want to offend you. You didn't blame the tools.

 

 

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 17
(4,696 Views)

Hey Henrik!
Thanks for your reply, yeah sure i can tell

 

i have a pump pumping water to the test rig which consists apart from everything else of a fluid friction bearing, two pressure sensors which collect pressure data from before the servovalve and after it. it is set so that i could measure some parameters of the valve. so there it is water flowing through the valve, which is connected to the AO and i send a sin like signal to it, so it closes and opens and i watch the pressure change. as the valve operates in sin, pressure also changes periodically with frequency about 0,5 Hz and amplitude of about 2-3 i guess so i need to measure the amplitude of the pressure sensors data. i have it already filtered so it should be no problem unless i fall at this last hurdle 😄 if you have any questions feel free to ask.

ps. yeah im a bad worksman, i was freaking out but not cause of my tools, but rather my not really understanding the labview stuff, you see i just started learning and data acquisition was my first and so far the only field of applying the labview. so all this analysis of digital data is somewhat of a uknown island i am exploring on my own and you particularly and all the gyus who kindly reply to my badworksman's messages are my teachers apart from my own process of trial and error. 😄 took no offence but laughed thanks Henrik! 🙂

______________________________________
i've got a rebel heart
0 Kudos
Message 4 of 17
(4,683 Views)

Hello, Lynn, thanks for clarifying these points to me, but if you could send me the .vi that you printscreened id say thaaanks haha 🙂 

Have a few questions now:

 

how do i link width of peak detector and a length of array, please tell me in three words if you may 🙂 

why did you put (-x) for the valley treshold?

why does this program refuse to work with certain parameters like no noise at all or 0 freq and amplitude of tones. if i exclude the block which generates tones, the peak detector does not show anything, the chart is frozen.

 

and finally i get this when i run the program as you suggest:

 

Thanks a lot!

 

 

 

______________________________________
i've got a rebel heart
0 Kudos
Message 5 of 17
(4,679 Views)

 

 


how do i link width of peak detector and a length of array, please tell me in three words if you may :smileyhappy: 


 

Only three words? Use a wire!

 

There really is no relationship between the width input to the peak detector and the length of the array, except that obviously a width larger than the length of the array will never find a peak. Start by reading the detailed help file for the Peak Detector VI.


 

width specifies the number of consecutive data points to use in the quadratic least squares fit. width is coerced to a value greater than or equal to 3. The value should be no more than about 1/2 of the half-width of the peaks/valleys and can be much smaller (but > 2) for noise-free data. Large widths can reduce the apparent amplitude of peaks and shift the apparent location. For noisy data, this modification is unimportant since the noise obscures the actual peak. Ideally, width should be as small as possible but must be balanced against the possibility of false peak detection due to noise.

With the noise amplitude about 10% of the sine amplitude I found that width needed to be larger than 10. This was with a frequency of 10 Hz which produced 100 samples per cycle. Thus, the width is > 10% of the period of the waveform. For other frequencies and other signal to noise ratios, other widths might be better.

 

The width parameter must often be determined empirically. If both the noise and the frequency of the signal change while the program is running, it may be very difficult to find a setting which works well for all cases. And having the program adapt may also be difficult unless you can clearly define how many peaks should be present at any given time.

 

I put the (-x) in because it seemed that the threshold should be negative for the valleys. If you have a reason to use the same threshold for both directions, it can be removed.

 


why does this program refuse to work with certain parameters like no noise at all or 0 freq and amplitude of tones?


When you add two arrays of different lengths, the resulting array is the length of the shorter input array. Some of the settings you describe probably result in an output of the noise generator having zero elements.  I do not see this effect for any settings of zero frequency amplitude. The Generator VIs generate 1000 element arrays with all zeros.  I notice that the valley detector seems to be more particular about the width setting with the sawtooth and square waveforms. This is probably due to the way it fits a quadratic curve to the data. The sharp edges on those waveforms do not fit well to a second order polynomial.

 

Lynn

0 Kudos
Message 6 of 17
(4,666 Views)

Here is something to play 🙂

amplitudemod.png

 

ARRRG this new NI forum fail to load my png  😞

 

OK no more block cutting, the block size  is generated 🙂

Assuming you know your base frequency I calculated some values for the peak valley stuff

and added my try with a fitting filter

 

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 ǝɥʇ'


Download All
0 Kudos
Message 7 of 17
(4,661 Views)

Minor error correction, (increment in the loop count )

Crude paramenter change detection 😮

and with changed start parameters, run, sit back and watch 😄

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 8 of 17
(4,652 Views)

Henrik thanks a lot for your help but i again have a problem of opening the file, if you could please resave it for the lv 2011 id much appreciate that thanks! 😄

 

Spoiler
shame on you, my tool! youre an outdated product! 😄

 

______________________________________
i've got a rebel heart
0 Kudos
Message 9 of 17
(4,633 Views)

here we go

 

 

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 10 of 17
(4,612 Views)