How do I get all possible combinations?

1 Ansicht (letzte 30 Tage)
Imran
Imran am 4 Nov. 2014
Kommentiert: Imran am 4 Nov. 2014
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?

Akzeptierte Antwort

Image Analyst
Image Analyst am 4 Nov. 2014
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 Kommentar
Imran
Imran am 4 Nov. 2014
I am adding 1 because 0 is also a generating scenario

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by