Is there any way we start with all ones vector of length 10 and need to increment it in steps till we have a vector of length 10 with each element equal to 30
Mostrar comentarios más antiguos
we start with a vector [1 1 1 1 1 1 1 1 1 1 ] and then need to get to the vector [30 30 30 30 30 30 30 30 30 30] in steps of one.i don't need the whole array at once just need one vector at a time. i think the question wasnt clear enough. The vector should start as [1 1 1 1 1 1 1 1 1 1] then it should go as [1.....1 2] [1....1 3] and so on till[1......1 30] ,then it should become[1....1 2 1]...[1...1 2 30],[1....1 3 1]..[1...1 3 30]....[1...1 30 30]....[1...1 30 30 30] and so on and go to [30 30 30 30 30 30 30 30 30 30].
Respuestas (1)
James Tursa
el 12 de Nov. de 2015
Start with:
v = [1 1 1 1 1 1 1 1 1 1 ];
Then for each increment do this:
v = v + 1;
Categorías
Más información sobre Fixed-Point Math Functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!