Borrar filtros
Borrar filtros

Why does my code say incorrect number or types of inputs or outputs for function specifyCoefficients?

39 visualizaciones (últimos 30 días)
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?

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Mzo. de 2024
There is no 'Face' parameter for that call.
  7 comentarios
Torsten
Torsten el 11 de Mzo. de 2024
Editada: Torsten el 11 de Mzo. de 2024
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
Walter Roberson el 11 de Mzo. de 2024
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.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by