How to set custom boundary conditions in the PDE Toolbox?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!