How do I specify the coefficients of a PDE which depends on the "x" and "y" coordinates using the Partial Differential Equation Toolbox?

2 次查看(过去 30 天)
For the case when using the Partial Differential Equation Toolbox in "eigenmode" with the PDE coefficients "c=1", "a=0", and "d=rho3(x)" on a circular domain with center (0,0) and radius 1 and Dirichlet condition "u=0":
The solver appears to treat the function "rho3(x)" as a constant function "y=1" rather than the step function taking values "y=2" on a part of the region.

采纳的回答

MathWorks Support Team
The reason is because of the function RHO3. The input "x" is a vector of "x"-coordinates. Thus, in the code, "y" is also assigned to 1 only.
The output "y" ( the values of "d") should be a vector, as well.
Try the following code:
function y=rho3(x)
% radial density function 3
y =ones(size(x));
idx = find((x < 0.5) & (x >= 0.0));
y(idx) = 2

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by