LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to give the tolerance of +-5% for an Array?

Solved!
Go to solution

I'm trying to build for developing some random values. So I took some array of data which was stored before and i want to change those values continuous values which should be in +-5% tolerance band.

for ex: Array- 10,20,30,40,50

I need the output as +-5% from the above values. Can anyone help me out with some suggestions?

0 Kudos
Message 1 of 5
(3,475 Views)
Solution
Accepted by topic author dhanushmh

Tools you need:

- For Loop which iterates as often as you have elements in your array (array size)

- Random Number to get a random number between 0 and 1. Scale the number to a value between -0.05 and +0.05. Inside the loop

- Add the scaled random number to 1. Use an indexing tunnel to create an array with numbers between 0.95 and 1.05

- Multiply the original array with the random number array

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 5
(3,453 Views)
Solution
Accepted by topic author dhanushmh

Like this?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(3,437 Views)

What if it's a 2D array? 

0 Kudos
Message 4 of 5
(3,397 Views)
Solution
Accepted by topic author dhanushmh

Then you have to nest the for loop in another for loop. The array size of the original array is giving you the numbers of rows and columns so you know how often each of the loop has to run.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 5 of 5
(3,393 Views)