creating array with entries as numbers

3 visualizaciones (últimos 30 días)
Debasish Mishra
Debasish Mishra el 24 de Feb. de 2020
Comentada: Alex Mcaulley el 24 de Feb. de 2020
i want to create an array indexing i=1:10
such that n{i}=1.44:1.45
so it must display n1=1.44
n2=1.441
.
.
n10=1.45
n=[n1 n2 n3 n4.....n10]
please help with this
  1 comentario
Stephen23
Stephen23 el 24 de Feb. de 2020
Use linspace (it will be more robust than using colon).

Iniciar sesión para comentar.

Respuestas (1)

Alex Mcaulley
Alex Mcaulley el 24 de Feb. de 2020
Do you mean this?
n = 1.44:0.001:1.45;
  2 comentarios
Debasish Mishra
Debasish Mishra el 24 de Feb. de 2020
not exactly.i want if i set i=1:p
then n should also automatically take p elements with equal interval.
Alex Mcaulley
Alex Mcaulley el 24 de Feb. de 2020
Then, as Stephen said use linspace:
n = linspace(1.44,1.45,10)

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by