MATLAB Numbers

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

10

Explanation:

  • 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.250000

Explanation:

  • 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 is

Output

real part is 120
imaginary part is 2

Explanation:

  • x is variable.
  • 120+2j is the complex value assign to variable x.

Leave a Comment

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

error: Content is protected !!
Scroll to Top