*SCAL
*SCAL, Name
, Val1
, VAL2
Scales a vector or matrix by a constant or a
vector.
Argument Descriptions
Name
Name used to identify the vector or matrix to be scaled. Must be specified.
Val1
When scaling a matrix or a vector by a scalar value,
Val1
is the real part of the constant to use (default = 1).When scaling a matrix or a vector by a vector,
Val1
is the name of the vector used for the scaling operation.VAL2
The imaginary part of the constant to use (default = 0). This value is used only if the vector or matrix specified by
Name
is complex.VAL2
is only valid for scaling by a constant. It is not used when scaling by a vector.
Notes
This command can be applied to vectors and matrices created by the *VEC, *DMAT and *SMAT commands.
Data types must be consistent between the vectors and matrices being scaled and the scaling vector (or constant value).
When scaling a matrix with a vector, the matrix must be square and the scaling vector must be the same size. See examples below.
Example Usage
Scaling a vector by a constant results in all vector values multiplied by the same constant value:
*SCAL,V,2 ! V[i] = V[i]*2
Scaling a matrix by a constant results in all matrix values multiplied by the same constant value:
*SCAL,M,2 ! M[i][j] = M[i][j]*2
The following command scales a complex values vector by a constant value of (2,1):
*SCAL,ZV,2,1 ! ZV[i] = ZV[i] * (2,1)
The following command scales a vector by another vector. All vector values are multiplied by the corresponding value in the scaling vector:
*SCAL,V,W ! V[i] = V[i] * W[i]
The following command scales a matrix by a vector, resulting in all matrix values scaled using the formula below:
*SCAL,M,V ! M[i][j] = M[i][j] * V[i] * V[j]