Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a way to draw a quadrangular surface in Mathematica so that it shows the bilinear term (not two triangles)? The quadrangular polygon is given by the expression

$$\phi = \sum_i^4 N_i U_i$$

where the $N_i$ are the Lagrangian shape functions (from finite element analysis), and the $U_i$ are the degrees of freedom. The shape functions are given by

N1[xi_, eta_] := (1 - eta) (1 - xi)/4;
N2[xi_, eta_] := (1 + eta) (1 - xi)/4;
N3[xi_, eta_] := (1 + eta) (1 + xi)/4;
N4[xi_, eta_] := (1 - eta) (1 + xi)/4;

So there is a bilinear term xi*eta that gives the curvature to the element.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

A polygon is a section of a plane, so it has no curvature, and using Polygon in Graphics3D won't work. You need a ParametricPlot3D.

N1[xi_, eta_] := (1 - eta) (1 - xi)/4;
N2[xi_, eta_] := (1 + eta) (1 - xi)/4;
N3[xi_, eta_] := (1 + eta) (1 + xi)/4;
N4[xi_, eta_] := (1 - eta) (1 + xi)/4;
shapeFuncs = {N1[xi, eta], N2[xi, eta], N3[xi, eta], N4[xi, eta]};
U = RandomReal[{0, 1}, 4];
phi[xi_, eta_] = shapeFuncs.U;
ParametricPlot3D[{{xi, eta, phi[xi, eta]}}, {xi, -1, 1}, {eta, -1, 1}]

Mathematica graphics

share|improve this answer
    
Thanks for you quick answer. Is there a way to show this plot on a portion of the space occupied by [-1,1]x[-1,1], for example the triangular region xi > eta? –  Alejandro Marcos Aragon Oct 3 '13 at 10:53
    
Use the option: RegionFunction -> Function[{xi, eta}, xi > eta] –  Timothy Wofford Oct 3 '13 at 11:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.