how to make a consecutive matrix before and after the decimal point?

2 visualizaciones (últimos 30 días)
Hello everyone ,
I have two numbers a=38.656528472900447 and b=43.667495727539006 I want to make an array which start from a to b but I can't do this a:b because I need every number after the decimal point to increase each time for example 38.656528472900447, 38.656528472900448 38.656528472900449 38.656528472900410 and so on ... till 43.667495727539006 and the numbers after the decimal point not static here it is 15 but it might be smaller or larger.. does any one have an idea of doing this?
thank you
  1 comentario
Stephen23
Stephen23 el 10 de Jun. de 2018
Editada: Stephen23 el 10 de Jun. de 2018
38.656528472900447 has seventeen significant digits, so it can't be reliably stored using single or double anyway. Perhaps you could try vpa, download hpf, or scale to uint64.

Iniciar sesión para comentar.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 10 de Jun. de 2018
You can use colon notation to specify the increment size. For example
2.12:0.01:2.22
ans =
Columns 1 through 7
2.1200 2.1300 2.1400 2.1500 2.1600 2.1700 2.1800
Columns 8 through 11
2.1900 2.2000 2.2100 2.2200
But as Stephen mentioned, your finite precision floating point number will not be able to provide the precision you require. You will need the symbolic toolbox.
vpa('38.656528472900447'):vpa('0.000000000000001'):vpa('43.667495727539006')
Note that I used a char array as input to vpa() to maintain precision. You can read more on this here. The above statement is theoretically correct but I doubt you will be able to store such large array. The increment size you need will require several petabytes of memory.

Más respuestas (0)

Categorías

Más información sobre Logical 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