如何在3D中绘制程序结果的总和?

时间:2015-05-04 11:32:39

标签: wolfram-mathematica procedural-programming

请帮我画一幅3D程序结果图。 该过程显示函数Sin [x]及其上的矩形和Ln [y]及其上的矩形的图形。enter image description here enter image description here

我需要在3D中绘制Sin [x]和Ln [y]的程序结果的总和,然后这些矩形应该是平行六面体。

spxsin = {-1, -0.35, 0.3, 0.95, 1.6, 2.375, 3.15, 3.925, 4.7, 5.025, 
   5.35, 5.675, 6};
spxlny = {1, 2.25, 3.5, 4.75, 6};
operation[value_, f_, a_, b_] := Block[{data},
  data = Table[{x, f[x]}, {x, a, b, 0.1}];
  Graphics[{Thick, Blue, Line[data],
    Green, 
    Table[Point[{value[[i]], f[value[[i]]]}], {i, 1, Length[value]}], 
    Pink, Opacity[.7], 
    Table[Rectangle[{value[[i]], f[value[[i]]]}, {value[[i + 1]], 
       f[value[[i + 1]]]}], {i, 1, Length[value] - 1}]
    }, Axes -> True]]

operation[spxsin, Sin, -1, 6]
operation[spxlny, Log, 1, 6]

我试过这样做:

Plot3D[{operation[spxsin, Sin, -1, 6] + operation[spxlny, Log, 1, 6]}, {spxsin, -1, 6}, {spxlny, 1, 6}]

Plot3D[{operation[spxsin, Sin, -1, 6] + operation[spxlny, Log, 1, 6]}, {x, -1, 6}, {y, 1, 6}]

但它不起作用:(

0 个答案:

没有答案