How do I get all possible combinations?

Hi, My data is such, I have 3 types of generators. Each type has several units and for each type the capacity of the units is same.
Type 1: 58 units, all of 60 MW capacity
Type 2: 5 units, all of 450 MW capacity
Type 3: 20 units, all of 600 MW capacity
This will give me (58+1) * (5+1) * (20+1) = 7434 generating scenarios.
My question is, what can I do to get all 7434 scenarios in decreasing order in a single row or column matrix?

 Accepted Answer

I don't know why you're adding 1 but to get all combinations you can use meshgrid():
[type1, type2, type3] = meshgrid(1:58, 1:5, 1:20);
type1 = type1(:);
type2 = type2(:);
type3 = type3(:);

1 Comment

I am adding 1 because 0 is also a generating scenario

Sign in to comment.

More Answers (0)

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Asked:

on 4 Nov 2014

Commented:

on 4 Nov 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!