Doubt in a product erro
Ältere Kommentare anzeigen
Hi, I have wrinting a code e get a 1×0 empty double row vector error
So, what I wrote:
t1 = 0:0.01:300;
pmenor = 25*0.9;
pmaior = 25*(1.1);
idx1 = find(t1== pmenor);
idx2 = find(t1 == pmaior);
I got
idx2 =
1×0 empty double row vector
But, if I write:
idx2 = find(t1 == 27.5);
idx2 =
2751
So I dont understand the error since idx1 gives me the correct answer, because we know that 25*1.1 = 27.5.
Thanks for reading.
Akzeptierte Antwort
Weitere Antworten (1)
the cyclist
am 2 Apr. 2021
1 Stimme
The reason has to do with the accuracy of floating-point math on a binary computer. I suggest you read this question and answer, to get a better understanding of what is going on.
1 Kommentar
Nélio Dias
am 4 Apr. 2021
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!