09-30-2024 09:19 AM - edited 09-30-2024 09:26 AM
Wanting to solve for an array holding these numeric values: 0.05, 0.1, 0.22, 0.45, 1.0, 2.2, and 4.4. All possible additive combinations thereof, each value used only once. Results such as, 0.05, 0.1, 0.15 ... and so forth. A result might be 0.45 but never 0.44, the latter resulting from 0.22 added to itself. Like that...
Said values are in mH (mili-Henries) representing toroid inductors in a relay-switched bank. Said bank being part of an automatic antenna tuner. I'm wanting to validate an antenna of my own design against a transceiver's capacity to null out its standing wave ratio it at various frequencies. An amateur radio project, which I shall publish in the public domain.
Solved! Go to Solution.
09-30-2024 09:41 AM
Very quick and dirty, chock full of coercion dots, and I'm not very well caffeinated yet, but I think this works and is mathematically sound:
09-30-2024 10:06 AM
...
All possible additive combinations thereof, each value used only once.
That doesn't make any sense.
09-30-2024 10:17 AM - edited 09-30-2024 10:20 AM
@BertMcMahan wrote:
Very quick and dirty, chock full of coercion dots, and I'm not very well caffeinated yet, but I think this works and is mathematically sound:
I had basically the same idea (count up to all possible 7 bit numbers (one bit for each value) and sum the ones where the bit=1.
You might want to sort the resulting array by the sum so it is easy to find the setting closest to the desired value.
09-30-2024 10:30 AM
After building the initial array at top left, and before the display "Number of Combinations", which VI is that, please? The image is slightly fuzzy, and I fail to recognize that VI.
09-30-2024 10:33 AM
Each value represents a physical component (a toroid inductor), switched in or out by a relay. No inductor may be used twice at same time. It is as if you have the values written down on pieces of paper. Then arrange them in combinations of one or more, adding the sum. No piece of paper can exist in two places at once. The same with a switched bank of physical components.
09-30-2024 10:37 AM
That's "Power of 2".
Also, that image is a VI Snippet, and you can drag it into LabVIEW without needing to recreate it:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US
09-30-2024 10:40 AM - edited 09-30-2024 10:41 AM
09-30-2024 11:04 AM
Yes! Thank you so much!