banner



How To Add A Number To A Specific Element Matlab

Complex Numbers in MATLAB

Introduction to Complex Numbers in MATLAB

Circuitous Numbers are the combination of existent numbers and imaginary numbers in the class of p+qi where p and q are the existent numbers and i is the imaginary number. An imaginary number is defined where i is the result of an equation a^2=-1. We can employ i or j to denote the imaginary units. As circuitous numbers are used in any mathematical calculations and Matlab is mainly used to perform mathematical calculations. So, complex numbers class an important part of learning Matlab.

Complex Numbers Generation in MATLAB

Complex Numbers can be created or alleged in Matlab using a 'complex' function. We can likewise create complex numbers by finding the square root of any negative number. In Matlab, we can utilize i or j to denote the imaginary part of the complex number.

Examples

X= 4+5i

Here X is a complex number which contains ii parts i.e. existent and imaginary part. iv is the real part and 5 is the imaginary part. We tin find the existent and imaginary parts using functions in Matlab.

  • a= real(10) = 4 (This gives the real part of the complex number)
  • b= imag(X)= 5 (This gives the imaginary part of the circuitous number)
  • complex (6,vii) = 6+7i (This role is used to create complex number)

We tin can as well create complex arrays in Matlab which can also exist declared using the complex functions.

  • a = complex (ten, y)

In that location are certain conditions for x and y that we should follow like ten and y should not be unmarried or double. A complex scalar can be created if two inputs are scalar in nature like,

  • X= complex (v,three)
  • Ten= 5.0000+3.0000i

Similarly, a complex vector can exist created if nosotros take 2 inputs as vectors.

  • X=uint8([iv;five;6;7]);
  • Y=uint8([3;5;i;2]);
  • a = complex (Ten, Y)

4 + 3i

five + 5i

half-dozen + 1i

vii + 2i

We can create a complex number having just one scalar like,

  • X = circuitous (10)
  • X= ten.0000+0.0000i

There are certain conditions that the input and output arguments should follow like,

The input arguments contain real and imaginary parts like x whatever y. x and y should be scalar, vector, multi-dimensional array or matrix in MATLAB. x and y size should be the same. They should be of the same data type but there are few exceptions like double can be used with single and integer can be combined with a double which is scalar.

The output of the array can be vector, scalar, matrix or multidimensional array depending on the input arguments. The size of the output should exist the aforementioned every bit the input. If the input arguments are of unlike data types than the output is determined by,

  • If either of the input arguments is single in nature than the output should also be single.
  • If either of the input arguments is an integer in nature, then the output should be of an integer data type.

We tin cheque whether the matrix is existent or imaginary by using isreal part.

Lawmaking:

Ten = [2+i,one];
Isreal(10)

Output:

Example 1

Lawmaking:

Isreal (10 (two))

Output:

Example 1-2

To excerpt the real and imaginary parts, we can use existent and imag functions in Matlab like,

Code:

real(Ten)

Output:

Complex Numbers in Matlab 1-3

Code:

imag(Ten)

Output:

Complex Numbers in Matlab 1-4

Operations and Functions of Complex Numbers in MATLAB

There are several operations and functions that can be performed using complex numbers in Matlab like

  1. abs: This function is used to find the modulus of any circuitous number in the grade of p+qi. abs(2+3i) = square root of [2^ii+3^2] = (xiii) ^0.5
  2. angle: To find the phase angle of the complex number.

There are certain tips that should be followed for the proper functioning of complex numbers in Matlab similar,

  • Nosotros should avert using i and j as office of whatever variable names every bit they are used in denoting the imaginary parts of the complex number.
  • We should avert using j or i if the imaginary part is 1. Instead, we can employ 1j or 1i.
  • Nosotros tin can create a circuitous office in Matlab when i and j are used as variable names in some role, input arguments are not of single or double type and the imaginary office is cypher.

Conclusion

Circuitous Numbers are used in the mathematical or engineering field. Many real-life or applied applications tin be described using the imaginary part of complex numbers. So, agreement the use and applications of complex numbers in diverse platforms is important especially if you are dealing with whatever physical or mathematical domain.

Recommended Manufactures

This is a guide to Complex Numbers in MATLAB. Here we hash out the introduction and complex number generation in matlab including its examples with operation and part. Yous may also look at the post-obit manufactures to larn more than-

  1. Cosmos of 3D Matrix in MATLAB
  2. Top 4 MATLAB Functions
  3. Features and Benefits of Versions in MATLAB
  4. Matlab Slope with Examples and Syntax

How To Add A Number To A Specific Element Matlab,

Source: https://www.educba.com/complex-numbers-in-matlab/

Posted by: scottuporthe.blogspot.com

0 Response to "How To Add A Number To A Specific Element Matlab"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel