# 2.2.18 mri2c

## Brief Information

Create complex matrix from two matrices

## Command Line Usage

 mri2c rm:=[MBook1]MSheet1!mat(1) im:=[MBook2]MSheet1!mat(1) cm:=<new>; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Real Matrix rm

Input

MatrixObject

<active>

Specifies the input matrix that has the real parts of the complex numbers.

Imaginary Matrix im

Input

MatrixObject

<unassigned>

Specifies the input matrix that has the imaginary parts of the complex numbers.

Complex Matrix cm

Output

MatrixObject

<new>

Specifies the output matrix where the complex numbers will be saved.

See the syntax here.

## Description

The mc2ri function combines real numbers in two matrices into complex numbers. The two input matrices should have the real parts and the imaginary parts of the complex numbers, respectively.

## Examples

• Sample Code
/*
In this example, a complex matrix is generated from two matrices
that have the real parts and imaginary parts of the complex numbers.
Then we calculate the amplitudes and phases of the complex numbers.
1. Fill two matrices with real numbers.
2. Combine these two matrices into a complex matrix.
3. Calculate the amplitudes and phases.
*/
window -t m;			//Create a matrix for the real parts
matrix -v sin(x)+cos(2*y);	//Set matrix value.
range m1=<active>;
window -t m;			//Create a matrix for the imaginary parts
matrix -v sin(2*x)+cos(y);	//Set matrix value.

mri2c rm:=m1 im:=<active>;	//Generate the complex matrix

mc2ap;				//Calculate the amplitudes and phases

## Related X-Functions

Keywords:real, complex numbers