array is approximated till fourth decimal

Test_Signal = [0.65163 0.07668 0.992269 -0.114643]
i have this array when i display it or check it in the work space it's approxaimated
till fourth decimal 0.0000 while it has 5 or 6 decimals 0.000000
how can i prevent it from approximation

5 commentaires

In many programs there is a difference between how values are stored and how values are displayed. Matlab is no exception to this. Which do you want to affect?
sprintf('%.6f',val)%display with 6 decimals
It's not approximation, it's display format
Try
format long
Hassan Bosha
Hassan Bosha le 21 Avr 2020
you mean when i use specific index in the array in an equation it's used with no approxiamation ?
Stephen23
Stephen23 le 21 Avr 2020
Modifié(e) : Stephen23 le 21 Avr 2020
You are mixing up two different things:
  • how numeric data are stored in a computer,
  • how numeric data are displayed by a computer.
What you see in the command window (or the Variable Viewer, or whatever) is just a displayed representation of the numeric data., it is not the numeric data itself. In MATLAB the Command Window representation can be controlled to show different number of fractional digits or precision, or use various notations: see the format command.
"when i use specific index in the array in an equation it's used with no approxiamation"
The precision of the numeric data stored or used in calculations does not change when you use indexing.
BALAJI KARTHEEK
BALAJI KARTHEEK le 21 Avr 2020
change the settings in preferences in matlab home page then u will get the required output in workspace

Réponses (0)

Cette question est clôturée.

Tags

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by