How do I create the follow array: [0 0 0 ... 0 1 2 ... 100 100 100], where there are 100 zeros on the left and 100 100's on the right? I must use the colon operator.

1 visualización (últimos 30 días)
For previous questions I just used, for example, [0:0.01:1], to create the array from 0 to 1 using increments of 0.01. I just do not know how to include multiple numbers before and after the beginning and end terms.
  2 comentarios
Jan
Jan el 31 de Ag. de 2017
Please mention it, when you post a homework question. This requires a different kind of answering.
Stephen23
Stephen23 el 31 de Ag. de 2017
Editada: Stephen23 el 31 de Ag. de 2017
@Sebastiano Inturrisi: rather than wasting time asking questions about how to use basic MATLAB, you should simply do the Introductory Tutorials, and learn how to concatenate arrays yourself:
Also reading the documentation is a good idea: zeros, ones, etc.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 31 de Ag. de 2017
Use the square brackets for a concatenation of arrays:
[1, 3, 5, 4]
or
a = 1:5;
b = [a, a]
Now create the 3 needed parts of the result and join them.
Please note that such basic questions are explained exhaustively in the Getting Started chapters of the documentation. It is efficient to read them, while asking the very basics in the forum is slower, because you have to wait until someone rephrases the information given in the documentation already.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by