How to increment from 1 to 0.0000000001 (9 zeros) in 11 rows, 1 column (divide by 10 each time)

1 visualización (últimos 30 días)
Hi everyone,
I was just a bit confused with how you increment a number list. I wanted to increment from 1 to 0.0000000001 (9 zeros) in a 1 columm 11 row format for a table. So basically divide each time by 10. Would it be some kind of loop because mine was simply not working. Thank you!

Respuestas (2)

Star Strider
Star Strider el 22 de Feb. de 2019
Use the logspace (link) function:
v = logspace(0, -9, 10)'
to get:
v =
1.000000000000000
0.100000000000000
0.010000000000000
0.001000000000000
0.000100000000000
0.000010000000000
0.000001000000000
0.000000100000000
0.000000010000000
0.000000001000000

Jos (10584)
Jos (10584) el 22 de Feb. de 2019
Editada: Jos (10584) el 22 de Feb. de 2019
format long % for display purposes only
v = 10.^(0:-1:-10).'

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by