permutation

i use the command a=perms([1,2,3,4]) ; and then may i have b11= 1,2 and b12= 3,4 b21=1,3 and b22 =2,4 b31=1,4 and b32= 2,3 plz explaine to me ??? thz for all

回答(2 个)

Andrei Bobrov
Andrei Bobrov 2012-4-16
nchoosek(1:4,2)
ON ko thant's answer
eg:
t = nchoosek(1:6,3);
p = 2;
A = t*[1;p;p^2];
A = reshape(A,[],2);
A = [A(:,1) A(end:-1:1,2)];

1 个评论

ko thant
ko thant 2012-4-21
огромное спосибо andrei bobrov

请先登录,再进行评论。

ko thant
ko thant 2012-4-17

0 个投票

andrei bobrov !!! thz u for help me. this command is right . may i have an another question.
A1[b11= 1 2 3 b11= 4 5 6] -> A1[b11= t1 + (p*t2) + (p^2*t3) b11= t4+ (p*t5)+(p^2*t6)]
A2[b12= 1 2 4 b12= 3 5 6]->A2[b12= t1+(p*t2)+(p^2*t4) b12= t3 +(p*t5)+ (p^2*t6)]
A3[b13= 1 2 5 b13= 3 4 6]->A3[b13= t1+(p*t2)+(p^2*t5) b13= t3+(p*t4) + (p^2*t6)]
A4[b14= 1 2 6 b14= 3 4 5]->A4[b14= t1+(p*t2)+(p^2*t6) b14= t3+(p*t4)+ (p^2*t5)]
A5[b15= 1 3 4 b15= 2 5 6]->A5[b15= t1+(p*t3)+(p^2*t4) b15= t2+(p*t5) +(p^2*t6)]
A6[b16= 1 3 5 b16= 2 4 6]->A6[b16= t1+(p*t3)+(p^2*t5) b16=(t2+(p*t4)+ (p^2*t6)]
A7[b17= 1 3 6 b17= 2 4 5]->A7[b17= t1+(p*t3)+(p^2*t6 b17= t2+(p*t4)+(p^2*t5)]
A8[b18= 1 4 5 b18= 2 3 6]->A8[b18= t1+(p*t4)+(p^2*t5) b18= t2+(p*t3)+ (p^2*6)]
A9[b19= 1 4 6 b19= 2 3 5]->A9[b19= t1+(p*t4)+ (p^2*t6) b19= t2+(p*t3)+ (p^2*t5)]
A10[b110=1 5 6 b110= 2 3 4 ] ->A10[b110=t1+(p*t5)+(p^2*t6) b110= t2+(p*t3)+(p^2*t4)]
above simple may i want ? above example is nchoosek(1:4,2) . i want to do any nchoosek(1:k,l)? thank for your reply

3 个评论

I don't understand your notation?
ko thant
ko thant 2012-4-17
A1[b11= 1 2 3 b12= 4 5 6] -> A1[b11= t1 + (p*t2) + (p^2*t3) b12= t4+ (p*t5)+(p^2*t6)]
A2[b21= 1 2 4 b22= 3 5 6]->A2[b12= t1+(p*t2)+(p^2*t4) b22= t3 +(p*t5)+ (p^2*t6)]
A3[b31= 1 2 5 b32= 3 4 6]->A3[b31= t1+(p*t2)+(p^2*t5) b32= t3+(p*t4) + (p^2*t6)]
A4[b41= 1 2 6 b42= 3 4 5]->A4[b41= t1+(p*t2)+(p^2*t6) b42= t3+(p*t4)+ (p^2*t5)]
A5[b51= 1 3 4 b52= 2 5 6]->A5[b51= t1+(p*t3)+(p^2*t4) b52= t2+(p*t5) +(p^2*t6)]
A6[b61= 1 3 5 b62= 2 4 6]->A6[b61= t1+(p*t3)+(p^2*t5) b62=(t2+(p*t4)+ (p^2*t6)]
A7[b71= 1 3 6 b72= 2 4 5]->A7[b71= t1+(p*t3)+(p^2*t6) b72= t2+(p*t4)+(p^2*t5)]
A8[b81= 1 4 5 b82= 2 3 6]->A8[b81= t1+(p*t4)+(p^2*t5) b82= t2+(p*t3)+ (p^2*6)]
A9[b91= 1 4 6 b92= 2 3 5]->A9[b91= t1+(p*t4)+ (p^2*t6) b92= t2+(p*t3)+ (p^2*t5)]
A10[b101=1 5 6 b102= 2 3 4 ] ->A10[b101=t1+(p*t5)+(p^2*t6) b102= t2+(p*t3)+(p^2*t4)]
ko thant
ko thant 2012-4-17
I would like to put 1,2,3 into b11 and 4,5,6 into b12. and then i would like to save these b11 and b12 in array(A1). later i'll substitute some parameters(t) instead of 1,2,3,4,5,6 . I have one example "nchoosek(1:6:3)". In this example the value of 6 and 3 are changing. According to this change of the values of 6 and 3, matrix (A1) will also change. Advise me please! how should i write the program for this requirement. and if it is possible for you to help me, give me some hands or some programms. I have shown my new example above and the old request was wrong.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Dates and Time 的更多信息

标签

提问:

2012-4-16

Community Treasure Hunt

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

Start Hunting!

Translated by