Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Assigning values for vector with certain rule

3 Ansichten (letzte 30 Tage)
Ju Kim
Ju Kim am 15 Jun. 2018
Geschlossen: KSSV am 15 Jun. 2018
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)

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by