nonzero m and d coefficients for Matlab PDE

2 views (last 30 days)
Hello, everyone!
I am trying to solve the 2D problem with Matlab PDE and need to specify both mass (m) and damping (d) to be nonzero.
Workflow in short:
create model with
model = createpde(N);
specify geometry ...
coefficients:
specifyCoefficients(model, 'm', rho, 'd', d, 'c', c, 'a', 0, 'f', f);
and solve it:
result = solvepde(model,time);
I got stuck having the error:
Error using pde.CoefficientAssignment/checkMandD (line 303)
When both 'm' and 'd' coefficients are nonzeros, the 'd' coefficient must be a matrix.
In the documentation to the function "specifyCoefficients" it is said:
Note: If the PDE to solve has both 'm' and 'd' coefficients that are
non-zero, then 'd' must be a matrix that has the same size as
the discretized mass matrix (not to be confused with 'm').
What is the correct way to specify 'd' coefficient when mass is nonzero?

Accepted Answer

Ravi Kumar
Ravi Kumar on 19 Mar 2019
Refer to this documentation:
d has to be a sparse matrix when m is non-zero.
  2 Comments
Joanna Chang
Joanna Chang on 6 Aug 2020
I am following the instructions here but it is unclear how to create this sparse matrix. I have a PDE system with 2 equations and two variables u1 and u2, and d should be 0 in the first equation and 1 for u2 in the second equation, such that d=[0 0; 0 1], what should the matrix be if result.M is of size 120x120?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!