Filter löschen
Filter löschen

how can i create matrix for all possible combination?

2 Ansichten (letzte 30 Tage)
Taehun Kim
Taehun Kim am 3 Sep. 2017
Bearbeitet: Stephen23 am 3 Sep. 2017
phi= [0.05, 0.1, 0.2, 0.5]
delta= [0.05, 0.1, 0.25, 0.5, 1.0, 2.0, 3.0]
I do need to create 4x7 =28 different combination. so final matrix should be
[0.05 0.05 ;0.05 0.1 ;0.05 0.25;.....]
something like this how can i create?

Akzeptierte Antwort

Stephen23
Stephen23 am 3 Sep. 2017
Bearbeitet: Stephen23 am 3 Sep. 2017
Use ndgrid:
>> [deltaM,phiM] = ndgrid(delta,phi);
>> [phiM(:),deltaM(:)]
ans =
0.05 0.05
0.05 0.1
0.05 0.25
0.05 0.5
0.05 1
0.05 2
0.05 3
0.1 0.05
0.1 0.1
0.1 0.25
0.1 0.5
0.1 1
0.1 2
0.1 3
0.2 0.05
0.2 0.1
0.2 0.25
0.2 0.5
0.2 1
0.2 2
0.2 3
0.5 0.05
0.5 0.1
0.5 0.25
0.5 0.5
0.5 1
0.5 2
0.5 3

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays 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