你的函数定义方法完全是错的……同学,基本语法要懂啊。
函数的自变量要使用方括号,圆括号在Mathematica里只表示运算的先后次序,对于你这种简单情形,简单地说,定义函数的时候,只有式子左边才要使用一条下划线(它实际上表示模式的匹配,具体你可以看看帮助);最那啥的是,你怎么定义函数全是用个大F啊?你该不会是觉得自变量不一样就不要紧了吧?形如“g_”的东西,上面说了,代表了一种模式,也就是说,它是什么字母,都是一样的;顺便使用大写字母定义函数是很不明智的。总之,你要这么改:
w = 1403
L = 150
a = 650
w1 = w/2 // N
r = 32.2
f[g_] = -w1 {Erf[(\[Pi]^(1/2)/r)] - Erf[(\[Pi]^(1/2)/r) (g - a)]}
i[y_] = -w1 {Erf[(\[Pi]^(1/2)/r) y] - Erf[(\[Pi]^(1/2)/r) (y - L)]}
h[g_, y_] = f[g] i[y]
Plot3D[%, {g, -200, 200}, {y, -200, 200}, PlotRange -> All]
Plot3D[f[x,y],{x,xmin,xmax},{y,ymin,ymax}]
在{xmin,xmax}间画出f[x]的Surface图形
Show[p] 重画图p,用法同二维
Show[Gaphics3D[p]] 将图p(可能是SurfaceGraphics)转
为Graphics3D,并重画
三维作图选项
PlotRange Automatic {zmin,zmax}或{{xmin,xmax},{y...},{z...}}
Axes轴 Automatic None
AxesLabel None {"x轴标","y轴标","z轴标"}
Ticks Automatic 刻度
PlotLabel图标 None 图的标记
Boxed盒子 True False
BoxRatios {1,1,0.4} {x,y,z}
HiddenSurface True False是否隐去曲面被挡部分
Shading True False是否涂阴影(颜色)
Mesh True False是否在曲面上画网格
LightSources 三个光源 设光源{{x,y,z},RGBColor[r,g,b]}
FaceGrids None All或坐标网格
ViewPoint视点 {1.3,-2.4,2.} {x,y,z}
{0,-2,0}正前方; {0,-2,2}前上方; {0,-2,-2}前下方;
{2,-2,0}正右角; {0,0,2}正上方; ...
PlotPoints 15 作图精度
(PlotPoints为Plot3D,ParametricPlot3D,ContourPlot等
plot函数选项)
In[1]:= Plot3D[Sin[x]y^2,{x,-3,4},{y,-2,2}]
In[2]:= Plot3D[Sin[x]y^2,{x,-3,4},{y,-2,2},PlotPoints->30]
In[2]:= Show[%, Mesh->False,Boxed->False,Axes->None]
参数绘图
ParametricPlot3D[{fx,fy,fz},{u,umin,umax},{v,vmin,vmax}]
等值线图
ContourPlot[f,{x,xmin,xmax},{y,ymin,ymax}]
选项Contours 10 从zmin到zmax等值线条数
密度图
DensityPlot[f,{x,xmin,xmax},{y,ymin,ymax}]
In[1]:= ParametricPlot3D[{Cos[5t],Sin[3t],Sin[t]},{t,0,2Pi}]
In[2]:= ParametricPlot3D[{u,u+v,v^2},{u,0,2},{v,-1,1}]
In[3]:= ContourPlot[Sin[x]Cos[y],{x,-2,2},{y,-2,2}]
In[4]:= Show[%,Contours->30]
In[5]:= DensityPlot[Sin[x]Cos[y],{x,-2,2},{y,-2,2}]
数据绘图
ListPlot[{y1,y2,...}] 画(1,y1),(2,y2),...
ListPlot[{{x1,y1},{x2,y2},...}]
ListPlot[...,PlotJoined->True] 连线
ListPlot3D[array]
In[1]:= t=Table[i^2,{i,10}]
In[2]:= ListPlot[t]
In[3]:= ListPlot[t,PlotJoined->True]
In[4]:= tt=Table[Mod[y,x],{x,20},{y,20}]
In[5]:= ListPlot3D[%,ViewPoint->{1.5,-0.5,1}]