matlab accuracy in linear functions
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Immelmann
le 13 Déc 2015
Réponse apportée : Walter Roberson
le 13 Déc 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 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Files and Folders dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!