Graphics Reference
In-Depth Information
The accuracy of the output of the results of operations with MATLAB can be relaxed using special techniques of
approximation to the exact with a certain degree of precision in the result. MATLAB represents results with accuracy,
but even if internally you always work with exact calculations to avoid rounding errors, you can enable different
approximate representation formats, which sometimes facilitate the interpretation of results. The commands that
allow numerical approximations are the following:
long format
It delivers results with 16 decimals
short format
It offers results with 4 decimals. It's the default format of MATLAB
format long e
Provides the results to 16 decimal places where a power of 10 is required
format short e
Provides the results to four decimal places where the power of 10 is required
format long g
It offers results in optimal long format
format short g
It offers results in optimum short format
bank format
It delivers results with 2 decimals
format rat
It offers the results in the form of a rational number approximation
format +
Offers the results sign (+, -) and ignores the imaginary part of the complex numbers
format hex
It offers results in the hexadecimal system
vpa 'operations' n
It provides the result of operations with n exact decimal digits
numeric ('expr')
Provides the value of the expression as a numeric approximation in the active current format
digits (n)
It offers the results with n digits
Using format gives a numerical approximation of 174/13 in the way specified in the format:
>> 174/13
years =
13.3846
>> long format; 174/13
years =
13.38461538461539
>> format long e; 174/13
years =
1.338461538461539e + 001
>> format short e; 174/13
years =
1.3385e + 001
Search WWH ::




Custom Search