(pde toolbox) help specifying c coefficient of specifyCoefficients as a function from a matrix

3 ビュー (過去 30 日間)
kira
kira 2019 年 4 月 8 日
コメント済み: kira 2019 年 4 月 8 日
Hello,
I'm trying to solve the coefficient variable poisson equation in 2d rectangular domain with dirichlet boundary conditions. Everything works fine specifying c coefficient as a function handle, for instance:
C=@(location,state)abs(cos(location.y/2)+sin(location.x/2));
F=C;
specifyCoefficients(model,'m',0,...
'd',0,...
'c',C,...
'a',0,...
'f',F);
At the end, I interpolate the solution on a grid mesh:
results = solvepde(model);
Nx=51;
Ny=21;
xq = linspace(a,b,Nx);
yq = linspace(c,d,Ny);
[X,Y] = meshgrid(xq,yq);
Z = interpolateSolution(results,X,Y);
Z = reshape(Z,size(X));
Now, I only have C values at the nodes of this grid mesh. Is there a way to put this matrix into a function to use as an input for specifyCoefficients?
  2 件のコメント
Ravi Kumar
Ravi Kumar 2019 年 4 月 8 日
Not sure, what you are asking for. Are you looking to specify c-coefficient as a marix instead of function? Or you want the value of c-coefficient at the grid points you are interpolating?
kira
kira 2019 年 4 月 8 日
sorry if it's not clear, I want the first. But I only have those coefficients in the grid.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGeneral PDEs についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by