Documentation Center

  • Trial Software
  • Product Updates

c for Systems

c as Tensor, Matrix, and Vector

This section describes how to write the coefficient c in the equation

or in similar equations. The coefficient c is an N-by-N-by-2-by-2 tensor with components c(i,j,k,l). N is the number of equations, see Systems of PDEs.

The notation means the N-by-1 matrix with (i,1)-component.

There are many ways to represent the coefficient c. All representations begin with a "flattening" of the N-by-N-by-2-by-2 tensor to a 2N-by-2N matrix, where the matrix is logically an N-by-N matrix of 2-by-2 blocks.

The matrix further gets flattened to a vector, where the N-by-N matrix of 2-by-2 blocks is first transformed to a "vector" of 2-by-2 blocks, and then the 2-by-2 blocks are turned into vectors in the usual column-wise way.

The coefficient vector c relates to the tensor c as follows:

Coefficient c(i,j,k,l) is in row (4N(j–1)+4i+2l+k–6) of the vector c.

Express c as numbers, text expressions, or functions, as in f for Systems.

Often, your tensor c has structure, such as symmetric or block diagonal. In many cases, you can represent c using a smaller vector than one with 4N2 components.

The number of rows in the matrix can differ from 4N2, as described in the next few sections.

In function form, the number of columns is Nt, which is the number of triangles in the mesh. The function should evaluate c at the triangle centroids, as in Scalar PDE Coefficients in Function Form. Give solvers the function name as a string 'filename', or as a function handle @filename, where filename.m is a file on your MATLAB® path. For details on writing the function, see Calculate Coefficients in Function Form.

Scalar c

The software interprets a scalar c as a diagonal matrix, with c(i,i,1,1) and c(i,i,2,2) equal to the scalar, and all other entries 0.

Two-Element Column Vector c

The software interprets a two-element column vector c as a diagonal matrix, with c(i,i,1,1) and c(i,i,2,2) as the two entries, and all other entries 0.

Three-Element Column Vector c

The software interprets a three-element column vector c as a symmetric block diagonal matrix, with c(i,i,1,1) = c(1), c(i,i,2,2) = c(3), and c(i,i,1,2) = c(i,i,2,1) = c(2).

Four-Element Column Vector c

The software interprets a four-element column vector c as a block diagonal matrix.

N-Element Column Vector c

The software interprets an N-element column vector c as a diagonal matrix.

    Caution   If N = 2, 3, or 4, the 2-, 3-, or 4-element column vector form takes precedence over the N-element form. So, for example, if N = 3, and you have a c matrix of the form

    you cannot use the N-element form of c, and instead would have to use the 2N-element form. If you give c as the vector [c1;c2;c3], the software interprets it as a 3-element form, namely

    Instead, use the 2N-element form [c1;c1;c2;c2;c3;c3].

2N-Element Column Vector c

The software interprets a 2N-element column vector c as a diagonal matrix.

    Caution   If N = 2, the 4-element form takes precedence over the 2N-element form. For example, if your c matrix is

    you cannot give c as [c1;c2;c3;c4], because the software interprets this vector as the 4-element form

    Instead, use the 3N-element form [c1;0;c2;c3;0;c4] or the 4N-element form [c1;0;0;c2;c3;0;0;c4].

3N-Element Column Vector c

The software interprets a 3N-element column vector c as a symmetric block diagonal matrix.

Coefficient c(i,j,k,l) is in row (3i+k+l–4) of the vector c.

4N-Element Column Vector c

The software interprets a 4N-element column vector c as a block diagonal matrix.

Coefficient c(i,j,k,l) is in row (4i+2l+k–6) of the vector c.

2N(2N+1)/2-Element Column Vector c

The software interprets a 2N(2N+1)/2-element column vector c as a symmetric matrix. In the following diagram, • means the entry is symmetric.

Coefficient c(i,j,k,l), for i < j, is in row (2j2–3j+4i+2l+k–5) of the vector c. For i = j, coefficient c(i,j,k,l) is in row (2i2+i+l+k–4) of the vector c.

4N2-Element Column Vector c

The software interprets a 4N2-element column vector c as a matrix.

Coefficient c(i,j,k,l) is in row (4N(j–1)+4i+2l+k–6) of the vector c.

Related Examples

Was this topic helpful?