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

1 visualizzazione (ultimi 30 giorni)
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!

Risposte (2)

Star Strider
Star Strider il 22 Feb 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) il 22 Feb 2019
Modificato: Jos (10584) il 22 Feb 2019
format long % for display purposes only
v = 10.^(0:-1:-10).'

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by