ListPlot3D doesn't work but ListPointPlot3D does (Mathematica)
The code below works, but when I replace the ListPointPlot3D with ListPlot3D it doesn't work!
This works:
ListPointPlot3D[Transpose[Table[{i,j, (150*(Sin[((i - 90)*2*3.14)/180]^2)* (Sin[((j - 45)*2*3.14)/180]^2)) - 150}, {i, 0, 270, 5}, {j, 0, 270, 5}]]]
This doesn't work:
ListPlot3D[Transpose[Table[{i,j, (150*(Sin[((i - 90)*2*3.14)/180]^2)* (Sin[((j - 45)*2*3.14)/180]^2)) - 150}, {i, 0, 270, 5}开发者_如何转开发, {j, 0, 270, 5}]]]
Any ideas why it doesn't work??
Your data:
In[1]:= Dimensions[
Transpose[
Table[{i,
j, (150*(Sin[((i - 90)*2*3.14)/180]^2)*(Sin[((j - 45)*2*3.14)/
180]^2)) - 150}, {i, 0, 270, 5}, {j, 0, 270, 5}]]]
Out[1]= {55, 55, 3}
But ListPlot3D wants a list of triples, so Flatten 1 level:
ListPlot3D[
Flatten[Transpose[
Table[{i,
j, (150*(Sin[((i - 90)*2*3.14)/180]^2)*(Sin[((j - 45)*2*3.14)/
180]^2)) - 150}, {i, 0, 270, 5}, {j, 0, 270, 5}]], 1]]
The Transpose is therefore redundant so this will do:
ListPlot3D[
Flatten[Table[{i,
j, (150*(Sin[((i - 90)*2*3.14)/180]^2)*(Sin[((j - 45)*2*3.14)/
180]^2)) - 150}, {i, 0, 270, 5}, {j, 0, 270, 5}], 1]]
Meanwhile, for this example, how about Plot3D instead:
Plot3D[(150*(Sin[((i - 90)*2*3.14)/180]^2)*(Sin[((j - 45)*2*3.14)/
180]^2)) - 150, {i, 0, 270}, {j, 0, 270}]
精彩评论