PDE toolbox, specifying coefficients, error telling me "Function specifying a coefficient must accept two input arguments and return one output argument."
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi every body
In my code the c coefficient in each point of the mesh is the components of the matrix B_HMM, but I don't know how I assign those.
It would be very much appreciated if somebody kindly pointed me into the right direction.
My code is:
model=createpde()
geometryFromEdges(model,g);
applyBoundaryCondition(model,'Edge',1:4,'u',@boundfun);
setInitialConditions(model,0);
generateMesh(model,'Geometricorder','linear');
generateMesh(model,'Hmax',H);
[p,e,t] = meshToPet(model.Mesh);
x = (p(1,t(1,:))+p(1, t(2,:))+p(1,t(3,:)) )/3;
y = (p(2,t(1,:))+p(2, t(2,:))+p(2,t(3,:)) )/3;
mp = [x;y];
macro_mesh.p=p; macro_mesh.e=e; macro_mesh.t=t; macro_mesh.mp=mp;
A_HMM = myHMM(macro_mesh,mp,cellSize,epsilon,aeps);
B_HMM=A_HMM';
specifyCoefficients(model,'m',0,'d',1,'c',@ccoeffunction,'a',0,'f',0);
T=1; dt=.1; N=T/dt;
tlist = 0:dt:T;
results = solvepde(model,tlist);
U_HMM = results.NodalSolution;
function cmatrix = ccoeffunction(location, B_HMM)
n1 = 4;
nr = numel(location.x);
cmatrix = zeros(n1,nr);
cmatrix(1,:) = B_HMM(1,:);
cmatrix(2,:) = B_HMM(2,:);
cmatrix(3,:) = B_HMM(3,:);
cmatrix(4,:) = B_HMM(4,:);
end
What is the problem of introducing of ccoeffunction function?
Of course, I didn't put here the long funcion A_HMM, because it works correctly.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur General PDEs dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!