how to make a consecutive matrix before and after the decimal point?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Ameer Hamza
2018년 6월 10일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!