How to find the Square or Cube of the vector in MATLAB?
Here is a syntax.
>> A = [1 1 3 4 5]; >> To find the square of vector A. >> A.^2 = [1 1 9 16 25] >> To find the cube of vector A. >> A.^3 = [1 1 27 64 125]
The Result on MATLAB display:
4. Square Root of the Vector:
Sqrt method is used for calculating the square root of the vector elements.
Example:
How to find the square root of the Vector in MATLAB?
Here is a syntax.
>> X = [2, 4, 1, 7, 8]; >> sqrt(X) = [1.4142 2.0000 1.0000 2.6458 2.8284]
The Result on MATLAB display:
5. Minimum or Maximum element of the Vector:
min and max syntax use for calculating the minimum and maximum elements of the vector.
Example: