How to set custom boundary conditions in the PDE Toolbox?

조회 수: 1 (최근 30일)
Jack
Jack 2014년 9월 20일
답변: Philip Caplan 2014년 9월 29일
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.

답변 (1개)

Philip Caplan
Philip Caplan 2014년 9월 29일
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:

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by