how can i create matrix for all possible combination?
2 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Stephen23
on 3 Sep 2017
Edited: Stephen23
on 3 Sep 2017
>> [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
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!