I used to interpolate the result to structured grid and display with 'mesh' or 'surf' functions, but sometimes the interpolated data was outside of the boundary. I have tried different interpolation method, but it doesn't help.
Interpolation data will appear outside of the boundary if you have a complex shape with concave geometry. Probably you did it with the meshgrid function. The only solution I know is to fill your array with NaNs or zeros in those unwanted points. Obviously you have to know the geometry in this case and write a few additional lines with the necessary conditions.
hi Daniel, Thanks for your suggestion, I have found that it uses the 'patch' function in the DistMesh Toolbox. It just need the information of vertices' position and the component of element. It runs much more fast than my interpolation method and the result is amazing.