This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Handle Complex Data

MATLAB® stores complex double-precision data as two vectors of numbers—one vector contains the real data and the other contains the imaginary data. The functions mxCopyPtrToComplex16 and mxCopyComplex16ToPtr copy MATLAB data to a native complex*16 Fortran array.

The example convec.F takes two complex vectors (of length 3) and convolves them. To see the source code, open the file in MATLAB Editor.

To build this example, at the command prompt type:

mex convec.F

Enter the following at the command prompt:

x = [3 - 1i, 4 + 2i, 7 - 3i];
y = [8 - 6i, 12 + 16i, 40 - 42i];


z = convec(x, y)
z =

   1.0e+02 *

  Columns 1 through 4 

   0.1800 - 0.2600i   0.9600 + 0.2800i   1.3200 - 1.4400i 
   3.7600 - 0.1200i

  Column 5 

   1.5400 - 4.1400i

which agrees with the results the built-in MATLAB function conv.m produces.

Was this topic helpful?