Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Assigning values for vector with certain rule
3 ビュー (過去 30 日間)
古いコメントを表示
n - number that I should assign firstly. Any integer from 1 to infinity. you can limit the upper limit of n for convenience. m = (n^2 + 3n)/2; r1 - should be assigned firstly; r2 - should be assigned firstly;
vector p has m number of members i.e) p=[1:1:m];
And there is a rule like this. example) for n=1 --> p(1)= r1, p(2)= r2 for n=2 --> p(1)= r1, p(2)= r2, p(3)= r1+r1, p(4) = r1+r2, p(5)= r2+r2 for n=3 --> p(1)= r1, p(2)= r2, p(3)= r1+r1, p(4) = r1+r2, p(5)= r2+r2, p(6)= r1+r1+r1, p(7)=r1+r1+r2, p(8)= r1+r2+r2, p(9)=r2+r2+r2 ... and so on
How can I make this p vector ? (Actually the order of members of p vector can be changed as long as p contains all members for its n and m. like p(1)=r1, p(2)=r1+r1, p(3)=r1+r1+r1, p(4)=r2, p(5)=r1+r2, ..... p(m)= r2+r2+r2+....+r2)
0 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!