Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
hello community.
need some support.
im trying to calculate all possible combinations of Voltage * Current
need to display all combinations in a matrix with only 1 column
in this case have 3 voltages and 3 currents
matrix result should be of 1column and 9 rows.
this is what I have up to now, but not been able to display each iteration.
Solved! Go to Solution.
A slightly shorter version than what Martin posted. We don't need to loop through one vector if we vectorize. Not better, just another way to go about it.
Two other ways - taking advantage of a DOE feature. fullfact provides the combinations of subscripts needed for every combination. Personally I'd just use nested for's since it's easier to understand and more flexible. But it's fun to explore new ways. (Note: answer sequence changes from other posts)
Hi,
The simplest method using the power of Prime
Cheers
Terry
Here's another approach:
with:
and
and
we get:
and with
we get
and with
we get
you could even
to get
Success!
Luc