How do you average waveforms in LabWindows like in test panel? I tried setting the NISCOPE_ATTR_RIS_NUM_AVERAGES to 16 (for 16 samples) but when I plot the waveform it doesn't look averaged.
In the test panel there is a drop down for "sample" mode and "averaging" mode. Is there another attribute to set the mode? I tried setting the enforced realtime to both true and false, get same result.
Solved! Go to Solution.
NISCOPE_ATTR_RIS_NUM_AVERAGES is an attribute used to set the number averages for each bin in an RIS acquisition. Random Interleaved Sampling is a form of equivalent-time sampling that increases apparent sample rates of repetitive signals by combining several triggered waveforms. By setting NISCOPE_ATTR_RIS_NUM_AVERAGES to 16 you're saying that you want 16 samples in each bin before the RIS acquisition is complete.
The averaging mode in the InstrumentStudio panel is software averaging, not implemented in the hardware/driver.
I did find this forum discussion of how to implement a moving average in LabVIEW: https://forums.ni.com/t5/LabVIEW/Simple-Moving-Average-VI/td-p/3274490
A colleague just reminded me that the NI-SCOPE measurement library supports averaging. You can find out more about how to do this here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019MuXSAU&l=en-US
I looked at the link and not sure if that's what I need. I think the "VOLTAGE AVERAGE" gives the average lets say I have a periodic square wave from 0 to 5V, the voltage average would give me 2.5V.
I am interested in averaging to minimize noise. The solution on that link refers to using Multi Acquisition Average Array Measurement but I don't see this in the library in LabWindows. The closest thing to that is niScope_FetchArrayMeasurement
You need to use Add Wfm Processing (http://zone.ni.com/reference/en-XX/help/370592AB-01/scopefunc/cviniscope_addwaveformprocessing/) and then use Multi Acq Average (http://zone.ni.com/reference/en-XX/help/370592AB-01/digitizers/multi_acq_average/) as the measurement function. You then use Fetch Array Measurement to get the averaged waveform.
I think this is what I need but I can't figure out how to use it. When I plot the waveform it doesn't look averaged. What are the steps I need to perform?
I tried calling AddWaveformProcessing and passing NISCOPE_VAL_MULTI_ACQ_AVERAGE as the function once.
Then I put FetchMeasurementArray with the NISCOPE_VAL_MULTI_ACQ_AVERAGE as the function in a loop 16 times for 16 averages.
I also tried putting the AddWaveformProcessing function inside the loop with the fetch function but doesn't seem to be any different when I plot the waveform.
The link you provided mentioned an averaged array, where is that? Is that the same one from the FetchMeasurementArray arraywaveformPointer?
Ok got it to work now. Thanks. To get the averaging to work you have to call the InitiateAcquistion everytime you fetch an array measurement with NISCOPE_VAL_MULTI_ACQ_AVERAGE as the function. Call this as many times as you want averaged.
Hi...So it means that the averaging is done on the scope card itself and then the averaged data is given out by Fetch function . Thanks
The averaging isn't actually done on the hardware, but in the driver software. You do have to call fetch to get the updated measurement though.