After reading the MATLAB Numbers topic, you will understand numbers and its classification as float, integer, and complex in MATLAB.
In MATLAB numbers are classified as
- Integer
- Float
- Complex
Integer
It is any number having the group of digits either from 0 to 9. The statement in MATLAB is given by
x=10; fprintf(Output
10Explanation:
- x is variable.
- 10 is the integer value assigned to variable x.
Float
It is any number containing a fractional part. The statement in MATLAB is given by
x=120.25; fprintf(Output
120.250000Explanation:
- x is variable.
- 120.25 is the float value assign to variable x.
Complex
It is any number having the imaginary part. The imaginary part is represented by letter j in MATLAB. The statement in MATLAB is given by
x=120+2*j; fprintf('real part is fprintf('imaginary part isOutput
real part is 120 imaginary part is 2Explanation:
- x is variable.
- 120+2j is the complex value assign to variable x.