Why does my code say incorrect number or types of inputs or outputs for function specifyCoefficients?
조회 수: 39 (최근 30일)
이전 댓글 표시
specifyCoefficients(smodel,'m', 1520,'d', 0,'c', 1,'a', 0, 'f', 0, 'Face', 1:3);
This is the code I'm trying to run with Matlab's PDE toolbox, but it says "incorrect number or types of inputs or outputs for function specifyCoefficients."
How do I fix the code?
댓글 수: 0
답변 (1개)
Walter Roberson
2024년 3월 10일
There is no 'Face' parameter for that call.
댓글 수: 7
Torsten
2024년 3월 11일
편집: Torsten
2024년 3월 11일
Can you run the following worked-out example from the PDE toolbox ?
Maybe you created a function with name "specifyCoefficients.m" in your working directory which overrides the built-in MATLAB function ?
model = createpde();
geometryFromEdges(model,@circleg);
figure
pdegplot(model,"EdgeLabels","on");
axis equal
applyBoundaryCondition(model,"dirichlet", ...
"Edge",1:model.Geometry.NumEdges, ...
"u",0);
specifyCoefficients(model,"m",0,"d",0,"c",1,"a",0,"f",1);
hmax = 0.1;
generateMesh(model,"Hmax",hmax);
figure
pdemesh(model);
axis equal
results = solvepde(model);
u = results.NodalSolution;
pdeplot(model,"XYData",u)
title("Numerical Solution");
xlabel("x")
ylabel("y")
hmax = 0.1;
error = [];
err = 1;
while err > 5e-7 % run until error <= 5e-7
generateMesh(model,"Hmax",hmax); % refine mesh
results = solvepde(model);
u = results.NodalSolution;
p = model.Mesh.Nodes;
exact = (1 - p(1,:).^2 - p(2,:).^2)/4;
err = norm(u - exact',inf); % compare with exact solution
error = [error err]; % keep history of err
hmax = hmax/2;
end
plot(error,"rx","MarkerSize",12);
ax = gca;
ax.XTick = 1:numel(error);
title("Error History");
xlabel("Iteration");
ylabel("Norm of Error");
figure
pdemesh(model);
axis equal
figure
pdeplot(model,"XYData",u)
title("Numerical Solution");
xlabel("x")
ylabel("y")
p = model.Mesh.Nodes;
exact = (1 - p(1,:).^2 - p(2,:).^2)/4;
pdeplot(model,"XYData",u - exact')
title("Error");
xlabel("x")
ylabel("y")
Walter Roberson
2024년 3월 11일
The dbstop is not intended as a cure for the problem. The dbstop tells the system that you want to debug specifyCoefficients from the beginning, and after you give that command, calling specifyCoefficients should stop in the debugger.
참고 항목
카테고리
Help Center 및 File Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!