Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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:
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?

Risposta accettata

Mike Garrity
Mike Garrity il 25 Apr 2016
I described one approach in this thread.
  3 Commenti
Mike Garrity
Mike Garrity il 26 Apr 2016
I think that passing a function handle into surf is making things more complicated than you really need.
I don't know what N3 is, but using the N from the top, I get this:
[s,t] = meshgrid(0:0.025:1);
z = t.*(2*t-1);
z(s+t > 1) = nan;

Accedi per commentare.

Più risposte (0)


Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by