数学实验 第四章

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

第四章练习题

(1)t=0:0.01:20;

x=exp(-0.2*t).*cos(pi/2*t);

y=pi/2*sin(t);

z=t;

plot3(x,y,z,'r');

(2)a=1;

t=-pi:0.01:pi;z=t;

x=a*(cos(t)).^3;

y=a*(sin(t)).^3;

plot3(x,y,z,'r');

(3)a=1;b=1;

t=0:0.01:2*pi;z=t;

x=a*(t-sin(t));

y=b*(1-cos(t));

plot3(x,y,z,'r');

(4)t=-pi:0.01:pi;

x=2*sin(t);

y=cos(t);

z=4*t;

plot3(x,y,z,'r');

(5)t=0:0.01:2*pi;

x=cos(5*t);

y=sin(3*t);

z=sin(t);

plot3(x,y,z,'r');

(6)[X,Y]=meshgrid([-30:0.3:30]);

r=X.^2+Y.^2;

Z=10*sin(sqrt(r))./(sqrt(1+r));

subplot(3,1,1),contour(X,Y,Z,20),title('等高线图');

grid on;

subplot(3,1,2),contour3(X,Y,Z,20),title('三维等高线图');

grid on;

subplot(3,1,3),meshc(X,Y,Z),title('三维图');

grid on;

(7)t=-1:0.1:1; [x,y]=meshgrid(t); z=x.^2+y.^2;

subplot(2,1,1),mesh(x,y,z),title('网格图');

subplot(2,1,2),surf(x,y,z),title('表面图');

(8)先将此方程化为参数方程:

4sin cos 9sin sin cos x y z ϕθϕθϕ=⎧⎪

=⎨⎪=⎩

其代码如下:

[phy,sita]=meshgrid([0:0.1:pi],[0:0.1:2*p i]);

x = 4*sin(phy).*cos(sita); y = 9*sin(phy).*sin(sita); z = cos(phy);

mesh(x,y,z),title('椭球面');

(9)

[t,u]=meshgrid([0:0.01:2*pi],[0:0.01:2*p i]);

x=cos(t).*(3+cos(u)); y=sin(t).*(3+cos(u)); z=sin(u); mesh(x,y,z);

(10)

[u,v]=meshgrid([0:0.01:2],[0:0.01:2*pi]); x=u.*cos(v);

y=u.*sin(v);

z=u.^2;

mesh(x,y,z);

思考与提高

1.t=-1:0.1:1;

[x,y]=meshgrid(t);

z=x.^2-2*y.^2;

mesh(x,y,z),title('马鞍形状');

2.①建立fun函数:

function dy=fun(x,y)

dy=x.*y;

②写M文件

clc,clear

a=0;b=4;c=0;d=4;n=15;

[X,Y]=meshgrid(linspace(a,b,n),linspace( c,d,n));

z=X.*Y;

fx=cos(atan(X.*Y));

fy=sqrt(1-fx.^2);

quiver(X,Y,fx,fy,0.5,'k'),hold

on,axis([a,b,c,d])

[x,y]=ode45('fun',[0,4],0.4);

plot(x,y,'r.-') 运行结果:

验证性实验 实验一空间曲线

1. t=0:0.01:10*pi; x=sin(t);y=cos(t);z=t;

subplot(2,1,1);plot3(x,y,z,'r'); t=0.1:0.01:1.5;

x=cos(t);y=sin(t);z=1./t;

subplot(2,1,2);plot3(x,y,z,'r');

2.首先把方程组化为以下形式:

x t y z ⎧=⎪⎪

=⎨⎪=⎪⎩

于是其代码为: t=0:0.01:1;

x=t;y=sqrt(t.*(1-t)); z=sqrt(1-x.^2-y.^2); plot3(x,y,z,'r');

3.t=0:0.1:10*pi;

x=t;y=sin(t);z=sin(2*t); plot3(x,y,z,'r');

4.t=0:0.1:10*pi;

x=sin(t);y=sin(2*t);z=sin(3*t); plot3(x,y,z,'r');

实验二二次曲线

1.x=-4:0.5:4;

y=x;

[X,Y]=meshgrid(x,y);

z=(1+X+Y).^2;

mesh(X,Y,z);

2.x=-4:0.5:4;

y=x;

[X,Y]=meshgrid(x,y);

z=X.^2+Y.^2;

mesh(X,Y,z);

3.

x=-4:0.4:4;

z=1./(x.^3-2*x+4);

[X,Y,Z]=cylinder(z,60);

mesh(X,Y,Z);

相关文档
最新文档