The c coefficient for assempde found in a matrix of x,y values.

1 view (last 30 days)
Hi,
I am trying to solve an elliptic PDE problem. I have a plate with two conductors and would like to find the electric potential on the plate.
My problem is that the plate has different c coefficients depending on the location on the plate and they are not dependent on a function, but are found in a matrix containing the c values for each point on the plate.
Does anyone know how to go about solving this problem?
Thanks, Fridrik

Answers (1)

Alan Weiss
Alan Weiss on 25 Aug 2015
Well, you don't have c values for every point in the plate, just some finite subset, or possibly the values are constant over small square regions or some such thing.
You can probably do one of several things, depending on what your model really is:
  • Use interp2 to interpolate your given c values smoothly to c values everywhere in the plate. Specify a nonconstant c coefficient.
  • Write a function that gives the c value for the closest point to each specified point. Again, you can use interp2 to do this, with the 'nearest' method.
I was assuming that you had 3-D geometry. If you have 2-D geometry, change my suggestions to interp1.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
Fridrik
Fridrik on 25 Aug 2015
Thank you very much for for the answer. I can see that I was not explaining myself well enough. I have a 2-D geometry, for example a 2 by 2 square. Then i have a matrix sigma=[0.5 1;1.5 2] that defines the c coefficients for each quarter of the 2 by 2 square.
Now my problem is assigning the values from the array c to c in the expression: [K,F] = assempde(model,c,a,f). I could do this by defining subdomains in the 2-D geometry but this is impossible with finer grids where the subdomains number a few hundreds.
I think I could interpolate my sigma matrix over the triangular mesh, but I don't know if that is the best way to go? Thanks again for any help provided, Fridrik
Alan Weiss
Alan Weiss on 25 Aug 2015
Thank you for clarifying your question, I have a much better idea what you are doing now.
You say "I could do this by defining subdomains in the 2-D geometry but this is impossible with finer grids where the subdomains number a few hundreds." Well, if you have hundreds of subdomains with c coefficient values, you have to face the data management problem somewhere. I think that you might as well face it in a nonlinear c coefficient written in two-dimensional functional form. The t argument contains the subdomain number, and you can simply extract that number and evaluate the vector ccoef(t(4,:)), where ccoef(i) contains the c coefficient for subdomain i.
Alternatively, if the c coefficient varies as a known function of x and y, you can simply write it that way using two-dimensional functional form.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!