Abs(x): Absolute value of scalar or length of vector.
Angle (z): the phase angle of complex number z.
Sqrt(x): square root
Real number (z): The real part of the complex number z.
Imag(z): imaginary part of complex number z
Conj(z): the complex number of the yoke of the complex number Z.
Round(x): Round to the nearest integer.
Fix(x): Whether it is a positive number or a negative number, round the decimal to the nearest integer.
Floor(x): floor function, that is, rounding the positive decimal to the nearest integer.
Ceil(x): ceiling function, that is, adding a positive decimal to the nearest integer.
Rat(x): Transform a real number x into a fractional representation.
Rats(x): Transform real number x into polynomial fractional expansion.
Symbol (x): Signum function.
When x
When x=0, sign (x) = 0;
When x>0, sign(x)= 1.
Rem(x, y): find the remainder of x divided by y.
Gcd(x, y): the greatest common factor of integers x and y.
Lcm(x, y): the least common multiple of integers x and y.
Index (x): natural index
Exponent of pow2 (x): 2
Log(x): the logarithm based on e, that is, the natural logarithm or
Log2(x): Log2-based logarithm
Log 10(x): Logarithm based on 10.
Trigonometric functions commonly used in MATLAB
Sin(x): sine function
Cos(x): cosine function
Tan(x): tangent function
Asin(x): arcsine function
Acos(x): cosine function
Atan(x): arc tangent function
Atan2(x, y): the arctangent function of four quadrants.
Sinh(x): Transcending Sinh Function
Cosh(x): Transcendental Cosine Function
Tanh(x): Transcendental Tangent Function
Asinh(x): Inverse Transcendental Sine Function
Acosh(x): Inverse Transcendental Cosine Function
Atanh(x): Inverse Transcendental Tangent Function
Variables can also be used to store vectors or matrices and perform various operations, such as row vector operations in the following example:
x =[ 1 3 5 2];
y = 2*x+ 1
y =
3 7 1 1 5
Tip: Rules for naming variables
1. The first letter must be English.
2. Don't leave spaces between letters.
3. There can only be 19 letters at most, and MATLAB will ignore the extra letters.
Common functions of vectors are:
Min(x): the minimum value of the elements of the vector x.
Max(x): the maximum value of the elements of vector X.
Mean(x): the average value of the elements of vector X.
Median(x): the median of the elements of vector X.
Std(x): standard deviation of the elements of vector x.
Diff(x): the difference between adjacent elements of vector x.
Sort(x): Sorts the elements of vector x..
Length(x): the number of elements of vector X.
Norm (x): Euclidean length of vector x.
Sum(x): the sum of the elements of vector X.
Prod(x): the total product of the elements of vector x.
Cumsum(x): the sum of the cumulative elements of vector X.
Cumprod(x): the total product of the cumulative elements of vector X.
Dot(x, y): the inner product of vectors x and y.
Cross(x, y): the outer product of vectors x and y.
(Most vector functions can also be applied to matrices, as described below. )
The following table is a common permanent constant in MATLAB.
I or j: basic imaginary unit
Eps: floating-point precision of the system.
Inf: infinity, such as 1/0.
NaN or nan: not a number, such as 0/0.
Pi: pi p = 3. 14 15926 ...)
Realmax: the maximum value that the system can represent.
Realmin: the minimum value that the system can represent.
Narrow: the number of input parameters of the function.
Narrow: the number of output parameters of the function.