Combination of Elements of Vectors

3 ビュー (過去 30 日間)
Temitope Amao
Temitope Amao 2018 年 5 月 6 日
コメント済み: Temitope Amao 2018 年 5 月 6 日
Please I need help creating a matrix containing all possible combinations of the elements of the following vectors: The order matters and elements are unique.
cf = [4.35e-09 7.25e-09 1.015e-08 ];
phif = [0.002 0.02 0.2];
kf0 = [ 4e-14 8e-14 1e-13];
xF = [100 120 150 180];
cm = [3.25e-10 7.25e-10];
cF = [4.35e-09 7.25e-09 1.015e-08];
Le = 880;
nHF = [8 : 1: 12];
ye = [(Le./nHF)./2];
yc = [0.4.*ye 0.6.*ye 0.8.*ye];
phim = [0.12 0.3];
kF0 = [5e-11 1e-10 1.5e-10];
kminfty = [1e-18 1e-19];
phiF = [0.002 0.02];
My objective at each STEP is:
var(i:number_of_possible_combinations) = [cf phif kf0 xF cm cF ye yc phim kF0 kminfty phiF ];

採用された回答

Stephen23
Stephen23 2018 年 5 月 6 日
Download Jos's excellent FEX submission allcomb, which does exactly what you want. I leave it up to you to decide if your computer has enough memory, and you have enough time to wait for this to be calculated.
  1 件のコメント
Temitope Amao
Temitope Amao 2018 年 5 月 6 日
It Worked. Thanks.

サインインしてコメントする。

その他の回答 (2 件)

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 5 月 6 日
Use concatenation function to create matrix using several vectors.
  1 件のコメント
Temitope Amao
Temitope Amao 2018 年 5 月 6 日
I'm trying to perform a combination so I'll have a whole lot of possible combinations not just a single matrix. I want to pick the first element of a vector and combine it with the first element of the other vectors and then the second etc..

サインインしてコメントする。


Ameer Hamza
Ameer Hamza 2018 年 5 月 6 日
matrix = combvec(cf, phif, kf0, xF, cm, cF, ye, yc, phim, kF0, kminfty, phiF);

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by