How to set custom boundary conditions in the PDE Toolbox?

4 visualizaciones (últimos 30 días)
Jack
Jack el 20 de Sept. de 2014
Respondida: Philip Caplan el 29 de Sept. de 2014
I have a temperature image (defined by a matrix of pixels) that I wish to use for my initial conditions in a PDE simulation.
I have generated a mesh, and have previously solved the PDE for the case when the initial conditions are constant temperature across the surface. I can also generate a surface plot of the desired initial condition from this image matrix, but how (if I can) do I set it as the initial condition for my PDE to evolve from?
Many thanks.

Respuestas (1)

Philip Caplan
Philip Caplan el 29 de Sept. de 2014
It is my understanding that you would like to specify image data as the initial condition to a time-dependent PDE.
You can do so by interpolating the image data to the coordinates of the vertices in your mesh and then pass those interpolated values as an initial condition.
Suppose your image data, defined at background vertices "xb" and "yb", is stored in the variable "ub0". We now want to get the values, "u0", of this initial condition at your mesh vertices with coordinates "x" and "y". The interp2 function will interpolate the background image data to the mesh vertices:
>> u0 = interp2(xb,yb,ub0,x,y);
You can then pass "u0" as an initial condition to a PDE solver since it is defined at the mesh vertices. For more information on interp2, please refer to:

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by