How to plot a triangular shape function on a triangular domain?

조회 수: 22(최근 30일)
Soroush Asarzadeh
Soroush Asarzadeh 2016년 4월 25일
댓글: Soroush Asarzadeh 2016년 4월 27일
Hello, I want to plot the following shape function: N(s,t)=t*(2*t-1) It has to look like the following diagramm:
but I get this one:
Here is my code:
[s,t]=meshgrid(0:0.1:1,0:0.1:1)
N3=@(s,t)t.*(2*t-1);
surf(s,t,N3(s,t))
I know that the problem is with the rectangular domain, that meshgrid generates. But I don't know how to define a triangular domain. Has anybody an idea?
Thanks

채택된 답변

Mike Garrity
Mike Garrity 2016년 4월 25일
I described one approach in this thread.
  댓글 수: 3
Soroush Asarzadeh
Soroush Asarzadeh 2016년 4월 27일
Thank you very much Mike!

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by