我正试图在Mathematica中做一个类似
的情节x^2 + y^2
x,y€[-10,10]。
除了显示情节之外,我还希望它包含以不同颜色绘制的点(例如,(0,0))。点(0,0)将显示为(0,0,0)。点(1,1)将显示为(1,1,2)等。
以下是我要找的内容:
我怎样才能做到这一点?
答案 0 :(得分:1)
f[x_, y_] := x^2 + y^2;
t = Flatten[Table[{x, y, f[x, y]}, {x, 0, 10, 1}, {y, 1, 2, 1}], 1];
a = ListPointPlot3D[t, PlotStyle -> PointSize[0.05]];
b = Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10},
ColorFunction -> "MintColors"];
Show[{b, a}]
你的台词:
f[x_, y_] := x^2 + y^2;
t = Flatten[Table[{x, y, f[x, y]}, {x, 0, 10, 1}, {y, 5, 5, 1}], 1];
l = Table[ Graphics3D[{Thickness[.01], Green,
Line[{i, {i[[1]], i[[2]], 200} }]}], {i, t}];
a = ListPointPlot3D[t, PlotStyle -> PointSize[0.05]];
b = Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10},
ColorFunction -> "MintColors"];
Show[{b, a, l}]