Partial Differential equation: Createpde. f as afunction

조회 수: 9 (최근 30일)
Poupak Kermani
Poupak Kermani 2025년 9월 14일
편집: Torsten 2025년 9월 14일
Hello, Using Createpde, how can I define f as a function (for example a Step function), instead of a constant?

답변 (1개)

Torsten
Torsten 2025년 9월 14일
편집: Torsten 2025년 9월 14일
Take a look at the example
"Coefficient Handle for Nonconstant Coefficients"
under
f = @fun;
%Set the coefficients in a 3-D rectangular block geometry.
model = createpde();
importGeometry(model,"Block.stl");
CA = specifyCoefficients(model,"m",0,...
"d",0,...
"c",1,...
"a",0,...
"f",f);
%Set zero Dirichlet conditions on face 1, mesh the geometry, and solve the PDE.
applyBoundaryCondition(model,"dirichlet","Face",1,"u",0);
generateMesh(model);
results = solvepde(model);
%View the solution on the surface.
pdeplot3D(model,"ColorMapData",results.NodalSolution)
function f = fun(location,state)
f = location.y.^2.*tanh(location.z)/1000;
end

카테고리

Help CenterFile Exchange에서 General PDEs에 대해 자세히 알아보기

제품


릴리스

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by