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.
w = 100 π;
vra1[t_] := 0.8 Sin[w t];
vrb1[t_] := 0.8 Sin[w t - 2 π/3];
vrc1[t_] := 0.8 Sin[w t + 2 π/3];
ia[t_, θ_] := 7.2 Sin[w t - θ];
ib[t_, θ_] := 7.2 Sin[w t - θ - 2 π/3];
ic[t_, θ_] := 7.2 Sin[w t - θ + 2 π/3];
v0[t_, θ_] := 
  Sign[vra1[t]] ia[t, θ] + Sign[vrb1[t]] ib[t, θ] + Sign[vrc1[t]] ic[t, θ];
Plot3D[v0[t, θ], {t, 0, 0.02}, {θ, -π, π}]

Plot3D does not dispaly the surface v0[t, θ]; it only shows the three dimensional axes. Please help me.

share|improve this question
Works for me. –  J. M. Apr 21 '13 at 3:46
Welcome to Mma.SE! Would you please change your name for better identification? –  mm.Jang Apr 21 '13 at 3:48
@J.M. We suppose it's a version-related problem. It failed in version 9.0.1 as I tested. –  mm.Jang Apr 21 '13 at 3:57
Same here, but the function is ok because when I use the ListPlot3D I got the plot. Perhaps more PlotPoints ? –  Spawn1701D Apr 21 '13 at 3:58
@mm.Jang, what happens if you directly feed the right-hand side of v0[t, θ] to Plot3D[]? –  J. M. Apr 21 '13 at 4:05

3 Answers 3

You have two options. Either you compile your function v0:

vv = Compile[{{t, _Real}, {θ, _Real}}, v0[t, θ]]

and plot it instead

Plot3D[vv[t,θ], {t, 0, 0.02}, {θ, -π, π}]

or define the two new functions f and v1

f[t_] := If[t > 0, If[π - Mod[Abs[t], 2 π] > 0 , 1, -1],
            If[t<0, If[π - Mod[Abs[t], 2 π] > 0 , -1, 1], 0]]


f[t_] = Sin[t]/Abs[Sin[t]]


v1[t_, θ_] := f[w t] ia[t, θ] + f[w t - 2 π/3] ib[t, θ] +f[w t + 2 π/3] ic[t, θ];

and plot v1 instead

Plot3D[v1[t, θ], {t, 0, 0.02}, {θ, -π, π}]

enter image description here

share|improve this answer

As far as I can tell this is a problem with the exclusions detection, which is removing all the vertices from the mesh.

A workaround is to use Exclusions -> None:

Plot3D[v0[t, θ], {t, 0, 0.02}, {θ, -π, π}, Exclusions -> None]

enter image description here

share|improve this answer

Hopefully, this is not as drastic as the proposal to compile the function. The trick is something well-known to those who know it:

v0[t_?NumericQ, θ_?NumericQ] :=
           Sign[Through[{vra1, vrb1, vrc1}[t]]].Through[{ia, ib, ic}[t, θ]]

where I have also taken the liberty to compact the definition slightly. The idea is to thwart the preliminary symbolic analysis Plot3D[] seems to try on your function, where it becomes rather overzealous in excluding what it thinks should be excluded. It should produce the same plots featured in Simon's and Spawn's answers...

share|improve this answer

Your Answer


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.