how to make a consecutive matrix before and after the decimal point?
1 view (last 30 days)
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?
Ameer Hamza on 10 Jun 2018
You can use colon notation to specify the increment size. For example
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.
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.