matlab accuracy in linear functions
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Immelmann
am 13 Dez. 2015
Beantwortet: Walter Roberson
am 13 Dez. 2015
Hello fellows,
help me understand Matlab accuracy. I try modeling simple “zick-zack” signal:
x=0:dt:4;
slope=0.1;
h=(numel(x)-1)/4;
y(1:h+1)=x(1:h+1)*slope;
y(h+2:3*h+1)=2*y(h+1)-(x(h+2:3*h+1)*slope);
y(3*h+2:4*h+1)=4*y(3*h+1)+(x(3*h+2:4*h+1)*slope);
and the last entry of y results to be -1,11022302462516e-16. I understand that there is a limit of accuracy but why here? Can you explain it for me or point my mistake

P.S:
In the end I change script to:
y(1:h+1)=x(1:h+1)*slope;
y(h+2:3*h+1)=2*y(h+1)-(x(h+2:3*h+1)*slope);
y(3*h+2:4*h+1)=y(2:h+1)-0.1;
and now I can search for all x=0 entries
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Files and Folders finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!