Explanation And Use Of Numeric Formats In MatLab®(Illustrated Expression)

Numeric formats are a very important thing in Matlab®. You need to adjust your numeric format according to your calculation and calculation accuracy. It is not necessary actually in Matlab® but if you do this, you will define the standard numeric display and calculation in Matlab®. So in this article, we will explain;

  • What are the numeric formats in Matlab® and what they do?
  • How to use numeric formats in Matlab®?

Numeric Format Codes In Matlab®

>> format long
a = 3/5

a =

   0.600000000000000

>> 

First of all, we want to explain the use of numeric formats in Matlab®. You just need to type the numeric format type that you want to use in your codes as shown above. For example, the ‘long’ format is used, and the displaying of a number is as in the green box above.

The use of numeric formats in Matlab® is like that.

Numeric Format And Their Duties In Matlab®

>>format short; The 4 decimal numbers will be shown after the comma such as 4.4125.

>>format long; 15 decimal numbers will be shown after the comma as 15.123654789321456.

>>format show e; 4 decimal numbers will be shown in scientific basis; 8.3333e+001.

>>format long e; 15 decimal numbers will be shown in scientific basis; 8.333333333333333e+001.

>>format short g; 5 numbers will be shown in total such as 44.125.

>>format long g; 15 numbers will be shown in total such as 15.1236547893214.

>>format hex; Hexadecimal format demonstration such as 4054d5555555.

>>format +; Shows the number’s case as +, – or 0.

>>format rational; Shows the number on the decimal basis as 500/6.

Conclusion

So these are the formats of the number demonstration in Matlab®.

If you want further coding examples about the numeric formats in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.


Posted

in

,

by

Comments


Leave a Reply

Your email address will not be published. Required fields are marked *