I need to find the subtraction of two vectors (to find the error), I did it as A-B. The result values are increasing with time, but the values of the two vectors exactly match! Any logical reason for that?
Attached is the mat file which contains the two vectors and the plot of the different. Thanks.

4 comentarios

KSSV
KSSV el 5 de Sept. de 2018
If your vector is obtained based on the previous iteration value.... the error gets increased. The plot is obvious. As the error is very less (10^-8) no need to worry.
Sara Hamdan
Sara Hamdan el 5 de Sept. de 2018
Thank you @KSSV. Can I make the difference exactly zero?
Stephen23
Stephen23 el 5 de Sept. de 2018
@Sara Hamdan: I don't understand your question. You state that "but the values of the two vectors exactly match!", but then you show a plot which apparently shows that they actually don't match. What is the exact problem that you are trying to resolve?
John D'Errico
John D'Errico el 5 de Sept. de 2018
You only THINK they match. They are close. And they are apparently the same but only to within around 1e-8.
Can you make the difference exactly zero? Of course.
B = A;
Now the difference is zero, and exactly so.
They are currently different because they way you created them, they are not the same. Yeah, that may seem trivial, but to make them the same either requires doing what I did above, or improving your skills in programming and numerical methods to know why they are not the same, and why they will probably never be exactly identical.
If you really want help in reducing the error, you need to show what you did.

Iniciar sesión para comentar.

 Respuesta aceptada

Steven Lord
Steven Lord el 5 de Sept. de 2018

0 votos

I suspect you believe they match because when you display them in the Command Window they display the same values. But as John D'Errico stated, they are close but not identical. They appear so using the default display format, but if you were to change to a different format they wouldn't.
format longg

1 comentario

Sara Hamdan
Sara Hamdan el 6 de Sept. de 2018
Thanks. Right, as you (@Steven) and @John said, the vectors appeared the same because the format in my Matlab is the default one, when I changed it to 'longg' the difference appeared.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Sept. de 2018

Comentada:

el 6 de Sept. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by