How I introduce a matrix form of c coefficient in PDE equation using solvepde matlab command
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
please how I introduce the c coeffecient which is has a matrix form:
c = [x-y, 0; 1, x.^2]
using "specifyCoefficients" and "solvepde" matlab command?
With best regards
I try this code
%======================================
numberOfPDE = 1;
model = createpde(numberOfPDE);
r1 = [3,4,0,0,0.5*10^-6,0.5*10^-6,-160*10^-9,-1.16*10^-6,-1.16*10^-6,-160*10^-9];
r2 = [3,4,0,0,0.5*10^-6,0.5*10^-6,0,-160*10^-9,-160*10^-9,0];
gdm = [r1; r2]';
g = decsg(gdm,'R1+R2',['R1'; 'R2']');
geometryFromEdges(model,g);
C = @(location,~)[location.x-location.y,0;1,location.x.^2];
F=@(location,~)location.x;
specifyCoefficientsspecifyCoefficients(model,'m',0,'d',0,'c',C,'a',0,'f',F);
msh = generateMesh(model,'Hmax',0.02,'GeometricOrder','linear','Jiggle','on');
pdeplot(model);
[p,e,t] = meshToPet(msh);
results = solvepde(model)
%==================================================================
and I obtain the error message:
Error using formGlobalKF2D
Coefficient evaluation function, "@(location,~)[location.x-location.y,0;1,location.x.^2]", was requested to calculate
coefficients at 1 locations so should have returned a matrix with 1 columns. Instead it returned a matrix with 2 columns.
0 commentaires
Réponses (1)
Ravi Kumar
le 2 Juil 2019
Output of c coefficient function should be a matrix or column vector of appropriate size, where the number of columns corresponds to spatial locations as provided by location.x and location.y. Try this:
C = @(location,~)[location.x-location.y; ...
ones(size(location.x));...
zeros(size(location.x));...
location.x.^2];
0 commentaires
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!