matlab accuracy in linear functions
3 views (last 30 days)
Show older comments
Immelmann
on 13 Dec 2015
Answered: Walter Roberson
on 13 Dec 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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Files and Folders in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!