05-29-2012 10:13 AM
05-29-2012 10:24 AM
Hello,
Assuming you already have an array with all the data in it, you could try having two for-loops [one inside the other], (one that goes up to 4901, and the inside one that goes up to 100,passing a starting value of the array X to which will receive up to X+100 samples to get your rms), using the Iteration numbers within the loops as reference.
Let me know if this idea helps,
05-29-2012 10:31 AM
Sorry... I have read the context help for the RMS ptbypt and I can't understand how the X input (signal) to the function changes for each interation... It is processing consecutive blocks of 100 samples...e.g block 1-100, 101-200, 201-300, etc, ct
Ohhhhh!! Hang on.... When the vi runs, the 2nd loop will not calculate the RMS until 100 samples became available, once the first 100 samples are available and the RMS is calculated, it will then update the 100 sample sequence (when the 101 sample is available) by dropping the oldest sample (i.e. sample 1), and adding the most recent sample (i,e, sample 101), providing an updated sequence on with the RMS calculation is performed...
Is this right? So all I would need to do is wire my 5000 sample signal straight through to the X input of the RMS ptbypt, which would be inside the for-loop (as you have it the 2nd loop above)?...
Now I feel stupid...
Thanks,
05-29-2012 10:46 AM
@jcannon wrote:
Is this right? So all I would need to do is wire my 5000 sample signal straight through to the X input of the RMS ptbypt, which would be inside the for-loop (as you have it the 2nd loop above)?...
That is right.
You might have to throw away the first 99 values from the output array, depending on your requirements. The for loop will output something regardless and you won't have a completed 100 sample RMS until the 100th iteration.
05-31-2012 06:08 PM
So the RMSptbypt will output values for any sample length, up to the sample length defined in the function.... So if I set the function to calculate the RMS over 100 samples, I will still get a value for any sample length between 1-99 samples?
Is that is the case I think it would be easier to use the subarray function to get the samples of interest so that I known than the output values form the RMSptbypt function directly match which the sections of the signal I am interested in.... I will nee tosynch these RMS values with other signals (e.g. force/strain), which will be mean dropping the first and last 50 sample from those signals...Using the subsarray will permit easier synching.
Regards,
Jack
05-31-2012 07:35 PM
So you are now looking for something like this? I scaled it down to test it. You would change the 10 to 100.
06-02-2012 07:09 AM
Hi crossrulz,
Your solves my problem... I made a couple of changes to include the window length and step length in the calculations...
Many thanks,
Jack
06-02-2012 04:01 PM
I think what you really want is this. You were shortening your window size and weren't stepping your windows position inside of the loop. Also, use the Quotient & Remainder VI for integers. It makes life a little easier.
06-03-2012 05:35 PM
Hi crossrulz,
This is brillant..!
Many thanks for your help!!
Regards,
Jack
02-16-2018 11:05 PM
You can use the moving average program for that.