06-16-2022 04:07 PM
I know my post from yesterday was about data inconsistency and I had multiple people here saying that the problem may be hardware and I believe that too. So now let's exclude the hardware part. I just want to know if anyone knows how to make my data linear? Well, it does not have to be 100% linear, but at least close. So how do I do that? (See my attached VI)
Scenario:
I attached a simple VI for the scenario. Feel free to modify if you'd like to.
Assume you have data that keeps increasing by 2 for every iteration. So 3, 5, 7 etc...
Now imagine your data starts from 3, 5, then all of a sudden jumps to 100, then back to 9. So 7 is skipped. . It should've been 3, 5, 7, 9 etc...
How do you prevent this jumping from happening. I thought about using "In range and coerce" block. I just don't think it will work or maybe I am not using it correctly (See VI).
Note: 100 is just a random number I picked. I just don't want the number to increase by more than 2.
So instead of getting 3-5-100-9, I would like the 100 or whatever number greater than the increment of 2 to be replaced by the previous number. For instance, I would like to get 3, 5, 5, 9 instead of 3, 5, 100, 9. The goal is to keep this increase exponential or linear.
Can someone please help?
FYI: I am more of a visual person. Please include a picture or VI for better understanding if you can.
Solved! Go to Solution.
06-16-2022 06:30 PM - edited 06-16-2022 06:30 PM
you can implement a simple moving average (use mean ptbypt) which will smooth out such abnormalities.
https://www.ni.com/docs/en-US/bundle/labview/page/ptbypt/mean_ptbypt.html
VI in LV2016 attached.
06-16-2022 08:25 PM
Here is the original post - https://forums.ni.com/t5/LabVIEW/Does-anyone-know-how-to-prevent-data-from-jumping-from-low-to/td-p/...
06-16-2022 08:32 PM
What do you mean by "force my data to be linear or exponential"? What do you mean by data being "linear"? And what do you mean by "exponential"? And don't you think it is a little suspicious that you keep describing yourself as a "visual person" and therefore need to have a picture or an actual VI? Sounds like we are doing your assignments for you ...
Bob Schor
06-16-2022 08:55 PM
Thanks Santo. This is what I wanted. So you just used the mean or average block. That's cool.
Thank you !
06-16-2022 08:58 PM - edited 06-16-2022 09:06 PM
Refer to Santo's answer. He understood what I was asking. You can just type words without a snippet or VI. What I meant is just with a snippet or VI, it's better to understand. I am not expecting no one to do my assignment. As a matter of fact, I do not have any assignment. I'm in this forum to learn. 90% of what I know from LabView is from this forum.
Trust me Bob_schor, I just don't copy code. I put enough time to understand other people's codes. You'll never know how many times I have spent trying to understand Mr. Altenbach's code. Trust me, I am not lazy. I work hard in silence. Notice I didn't ask questions last week because I am getting better. I think it will come time when I'll only ask a question once every 5 months and you will miss me. 😂
06-17-2022 01:07 AM
Measurement data is just that. You have no control over it in your program. You only have control over what your program generates internally.
If you don't like your measurement data, just glossing over it by averaging is probably not the right things to do. If you have reason to believe that some data points are false and others are correct, you need to decide how to recognize good from bad data. In this case it is relatively easy because you seem to independently know that the data should be increasing at a constant slope, so whenever you get a data point that does not meet expectations (within a certain defined envelope based on historical data and expectations) you can simply reject and ignore it. It is false to just replace it by made-up data without letting the user know that it is not real.
If you look at the earlier averaging suggestion, you can see that while averaging does smooth out the spikes, it also shifts all "correct" points, meaning that now all points are wrong!