How to specify f coefficient function for arbitrarily located point sources within a domain.

1 view (last 30 days)
I'm trying to use the PDE toolbox to model an asymmetric 2D geometry over which to solve Poisson's electrostatic equation, . The problem is, for each simulation, I will generate some number of randomly located charges within my geometry, so the charge distribution will take the form of , where and are the location of the charge, q, and A is the area of the traingular mesh element containing that charge (in general, a function of x and y). All of the documentation about creating an f-coefficient function (i.e. ) seems to only allow coding an f-function with predetermined charge locations. In other words, the f function must be of the form f(location,state), and can take no additional inputs to specify the locations of the charges. This seems like a pretty straightforward problem I'm trying to simulate. Is there an easy way to create an f-coefficient function that models point sources within various mesh traingles? Thank you!

Answers (1)

Ravi Kumar
Ravi Kumar on 28 Aug 2019
If you want to use addtional arguments in computing f, then wrap the f coefficient function around the actual function that takes additional arguments:
fFcn = @(location,state) actualComputaionFunction(location,state, additionalArg1, additionalArg2)
provide fFcn as input to specify coefficient.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!