第四讲 用Mathematica画函数图形

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

圆锥面 ParametricPlot3D[{u*Cos[v],u*Sin[v],u}, {u,-4,4},{v,4,4},AxesLabel->{x,y,z}]
图形的叠加
Show[{f1,f2, … },options] 将多个图形组合成一个图
例1: t1=Plot[x/3,{x,-4,4},PlotStyle->RGBColor[1,0,0]]; t2=Plot[Sin[x],{x,-Pi,Pi}, PlotStyle-> RGBColor[0,1,0]]; Show[{t1,t2},AxesLabel->{x,y}]
如: Plot [Sin[1/x], {x, -0.01, 0.01}, PlotPoints->100]
参数方程
参数方程命令格式:
ParametricPlot [ {x[t],y[t]}, {t, tmin, tmax}, 可选项] 如: ParametricPlot [ {2*(t-Sin[t]),2*(1-Cos[t])},{t, 0, 2Pi},
函数表达式
图形参数的设定
如: Plot [Sin[x], {x, -2Pi, 2Pi}, AspectRatio->Automatic]
如: Plot [Exp[1/x], {x, -1, 2}, PlotRange->{-1,5}]
可以同时画多个函数的命令格式
Plot [{ f1[x],f2[x],…}, {x, xmin, xmax}, 可选项] 如: Plot [{Sin[x], Sin[2*x]/2,Sin[3*x]/3},{x, -2Pi, 2Pi}] 如: Plot [Evaluate[Table[x^n,{n,4}]],{x, 0, 1}]
True(默认值) 、False
✓ Axes:用于指定是否显示坐标轴
三维图形命令
如: Plot3D [Sin[x*y]], {x, -3, 3},{y, -3, 3}, PlotPoints -> 40]
如: ParametricPlot3D [{u*Cos[v],u*Sin[v], Exp[-u^2/2]}, {v, 0, 2Pi},{u,0,4}, PlotPoints->20,BoxRatios-> {1,1,0.4}, Boxed->False,Axes->False]
第四讲
用MathemaΒιβλιοθήκη Baiduica画函数图形
用Mathematica画函数的图形
基本的一元函数作图 二维作图的可选参数 参数方程作图 极坐标方程作图 三维图形命令
基本的一元函数作图
命令格式: 自变量的取值范围
Plot [ f[x], {x, xmin, xmax}, 可选项]
二维作图的可选参数
第一类参数:与图形显示有关
✓ AspectRatio:改变图形显示的横纵坐标的比例; ✓ Frame:是否给图形加边框,默认为False; ✓ PlotRange:用于指定图形在纵坐标方向上的范围;
✓ Axeslable :用于给坐标轴加上标记 ✓Axes: 指定是否显示坐标轴
AspectRatio->Automatic]
极坐标方程作图
极坐标方程作图
✓ 先要定义极坐标下的函数 ✓ 再利用参数式绘图
如: r[t_]:=2*Cos[2t]
ParametricPlot [ {r[t]*Cos[t],r[t]*Sin[t]},{t, 0, 2Pi},
AspectRatio->Automatic]
✓ PoleStyle:说明用什么方式画图形; • RGBColor:图形的颜色 • Thickness[t]:描述线的宽度 • Dashing:用于画虚线
✓ PlotPoints:用于说明采样点的基本点数
Background: 用于指定背景颜色 Automatic 实际颜色与Windows窗口背景色一致
三维图形命令
命令格式:
Plot 3D[ f[x,y], {x, xmin, xmax},{y,ymin,ymax} , 可选项] ParametricPlot3D[{x[u,v],y[u,v],z[u,v]},{u,u1,u2},{v,v1v2} , 可选项]
常用参数
✓ Lighting:关照参数 ✓ ViewPoint->{x0,y0,z0}:表示视点的位置 ✓ Boxed:用于指定显示或取消边框
如: Plot [{Sin[x], Sin[2*x]/2,Sin[3*x]/3},{x, -2Pi, 2Pi}, PlotStyle->{RGBColor[1,0,0], RGBColor[0,1,0], RGBColor[0,0,1]}]
二维作图的可选参数
如: Plot [Exp[x], {x, -5, 2}, PlotStyle->{RGBColor[1,0,0], Dashing[{0.02,0.02}],Thickness[0.01]},PlotPoints->1000]
例2: 由z 1 x2 y2 , x2 y2 x及xoy面围成的立体。
t1= ParametricPlot3D[{Cos[u]*Sin[v],Sin[u]*Sin[v], Cos[v]}, {u,0,2Pi},{v,0,Pi/2}];
t2= ParametricPlot3D[{(Cos[u]+1)/2,Sin[u]/2,v}, {u,0,2Pi},{v,0,1.1}];
True(或Automatic)显示坐标轴
如: Plot [Sin[x], {x, -2Pi, 2Pi}, AspectRatio->Automatic, Frame->True, AxesLabel->{x, Sin[x]}, PlotRange->{-2,2}]
二维作图的可选参数
第二类参数:对图形的修饰与加工
球面: ParametricPlot3D[{Cos[u]*Sin[v],Sin[u]*Sin[v],
Cos[v]}, {u,0,2Pi},{v,0,Pi},AxesLabel->{x,y,z}]
双曲抛物面(马鞍面) ParametricPlot3D[{u,v, (u^2-v^2)/2.5},{u,-4,4},{v,4,4},AxesLabel->{x,y,z}]
Show[{t1,t2},AxesLabel->{x,y}]
例3:绘制由z=3-2x^2-y^2与z=x^2+2y^2围成的立体 z1 3 2 x ^2 y^2; z2 x^2 2 y^ 2; x r Cos ; y r Sin ; tu ParametricPlot3D x, y, z1 , x, y, z2 , , 0, 2 Pi , r, 0, 1
相关文档
最新文档