Generating a square mesh

조회 수: 15 (최근 30일)
Saim Ehtesham
Saim Ehtesham 2022년 11월 16일
편집: Bruno Luong 2022년 11월 16일
I have found a book that teaches the solution of PDEs and plots the results.
I want to change the plot to a square mesh instead of traingular mesh.
This the code they use:
tri = delaunay(x,y);
trisurf(tri,x,y,u_fem);
which generates something like this:
How do I make sure that the mesh generated does not have those diagonal lines between the squares? and then plot that?
*using MATLAB online
Let me know if the entire code is needed, its in multiple bunches
Thanks
  댓글 수: 1
Bruno Luong
Bruno Luong 2022년 11월 16일
편집: Bruno Luong 2022년 11월 16일
Finite Elements methods (FEM) must work on triangular mesh, so it must have those diagonals to form set of triangles.
This piece of code show exactly the mesh as it is. This is a good visualization.

댓글을 달려면 로그인하십시오.

채택된 답변

Askic V
Askic V 2022년 11월 16일
If you look at the examples in the Matlab documentation for the mesh function, you can find something like this:
[X,Y] = meshgrid(-5:.5:5);
Z = Y.*sin(X) - X.*cos(Y);
s = mesh(X,Y,Z,'FaceAlpha','0.5');
As you can see this division is not triangular nor does it have diagonals.
  댓글 수: 1
Saim Ehtesham
Saim Ehtesham 2022년 11월 16일
when I am plotting it on a few different functions, I see a horizontal green line mesh at x and y =0 other than the curved lines, how can I fix that?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by