nonzero m and d coefficients for Matlab PDE
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Ravi Kumar
2019-3-19
Refer to this documentation:
d has to be a sparse matrix when m is non-zero.
2 个评论
Joanna Chang
2020-8-6
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!