|On this page…|
This section describes how to write the coefficients a or d in the equation
or in similar equations. a and d are N-by-N matrices, where N is the number of equations, see Systems of PDEs.
Express the coefficients as numbers, text expressions, or functions, as in f for Systems.
The number of rows in the matrix is either 1, N, N(N+1)/2, or N2, as described in the next few sections. If you choose to express the coefficients in functional form, the number of columns is Nt, which is the number of triangles in the mesh. The function should evaluate a or d 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 how to write the function, see Calculate Coefficients in Function Form.
Often, a or d have structure, either as symmetric or diagonal. In these cases, you can represent a or d using fewer than N2 rows.
The software interprets an N-element column vector a or d as a diagonal matrix.
For example, if N = 3, a or d could be
a = char('sin(x) + cos(y)','cosh(x.*y)','x.*y./(1+x.^2+y.^2)') % or d
a = sin(x) + cos(y) cosh(x.*y) x.*y./(1+x.^2+y.^2)
The software interprets an N(N+1)/2-element column vector a or d as a symmetric matrix. In the following diagram, • means the entry is symmetric.
Coefficient a(i,j) is in row (j(j–1)/2+i) of the vector a.
The software interprets an N2-element column vector a or d as a matrix.
Coefficient a(i,j) is in row (N(j–1)+i) of the vector a.