东北大学MATLAB实验参考答案.docx

上传人:b****7 文档编号:10894468 上传时间:2023-02-23 格式:DOCX 页数:38 大小:329.93KB
下载 相关 举报
东北大学MATLAB实验参考答案.docx_第1页
第1页 / 共38页
东北大学MATLAB实验参考答案.docx_第2页
第2页 / 共38页
东北大学MATLAB实验参考答案.docx_第3页
第3页 / 共38页
东北大学MATLAB实验参考答案.docx_第4页
第4页 / 共38页
东北大学MATLAB实验参考答案.docx_第5页
第5页 / 共38页
点击查看更多>>
下载资源
资源描述

东北大学MATLAB实验参考答案.docx

《东北大学MATLAB实验参考答案.docx》由会员分享,可在线阅读,更多相关《东北大学MATLAB实验参考答案.docx(38页珍藏版)》请在冰豆网上搜索。

东北大学MATLAB实验参考答案.docx

东北大学MATLAB实验参考答案

《MATLAB语言与应用》实验课程任务书

一、实验教学目标与基本要求

上机实验是本课程重要的实践教学环节;实验的目的不仅仅是验证理论知识,更重要的是通过上机实验,加强学生的实验手段与实践技能,掌握应用MATLAB语言求解问题的方法,培养学生分析问题、解决问题、应用知识的能力和创新精神,全面提高学生的综合素质。

上机实验共8学时。

主要实验内容是基于理论课所学知识对课后典型习题进行MATLAB求解,基本掌握常见数学问题的求解方法与命令调用,更深入地认识和了解MATLAB语言强大的计算功能。

上机实验最终以书面报告的形式提交,并作为期末成绩考核内容的一部分。

二、实验内容(8学时)

第一部分MATLAB语言编程、科学绘图与基本数学问题求解(4学时)

主要内容:

掌握MATLAB语言编程基础、科学绘图方法、微积分问题、线性代数问题等基本数学问题的求解与应用。

练习题:

1、安装MATLAB软件,应用demo命令了解主要功能,熟悉基本功能,会用help命令。

2、用MATLAB语句输入矩阵

前面给出的是

矩阵,如果给出

命令将得出什么结果?

 

Input

A=[1,2,3,4;4,3,2,1;2,3,4,1;3,2,4,1];

B=[1+4j,2+3j,3+2j,4+1j;4+1j,3+2j,2+3j,1+4j;2+3j,3+2j,4+1j,1+4j;3+2j,2+3j,4+1j,1+4j];

A(5,6)=5

Answer=

A=

123400

432100

234100

324100

000005

 

3、假设已知矩阵

,试给出相应的MATLAB命令,将其全部偶数行提取出来,赋给

矩阵,用

命令生成

矩阵,用上述命令检验一下结果是不是正确。

 

Input

A=magic(8);

B1=A(2:

2:

end,:

Answer=

B1=

955541213515016

4026273736303133

4123224445191848

858595462631

 

4、用数值方法可以求出

,试不采用循环的形式求出和式的数值解。

由于数值方法是采用double形式进行计算的,难以保证有效位数字,所以结果不一定精确。

试采用运算的方法求该和式的精确值。

 

>>formatlong;sum(2.^[0:

63])

ans=

1.844674407370955e+019

5、选择合适的步距绘制出下面的图形。

(1)

,其中

(2)

,其中

(1)>>t=-1:

0.03:

1;y=sin(1./t);plot(t,y)

>>t=[-1:

0.03:

-0.25,-0.248:

0.001:

0.248,0.25:

.03:

1];y=sin(1./t);plot(t,y)

(2)>>x=[-pi:

0.05:

pi];...

y=sin(tan(x))-tan(sin(x));...

plot(x,y)

x=[-pi:

0.05:

-1.8,-1.799:

.001:

-1.2,-1.2:

0.05:

1.2,1.201:

0.001:

1.8,1.81:

0.05:

pi];...

y=sin(tan(x))-tan(sin(x));...

plot(x,y)

6、试绘制出二元函数

的三维图和三视图。

>>[x,y]=meshgrid(-2:

.1:

2);...

z=1./(sqrt((1-x).^2+y.^2))+1./(sqrt((1+x).^2+y.^2));...

surf(x,y,z),shadingflat...

[x,y]=meshgrid(-2:

.1:

2);...

z=1./(sqrt((1-x).^2+y.^2))+1./(sqrt((1+x).^2+y.^2));subplot(224),surf(x,y,z)...

subplot(221),surf(x,y,z),view(0,90);...

subplot(222),surf(x,y,z),view(90,0);...

subplot(223),surf(x,y,z),view(0,0);

 

7、试求出如下极限。

(1)

(2)

;(3)

(1)>>symsx;f=(3^x+9^x)^(1/x);L=limit(f,x,inf)

L=

9

(2)

symsxy;f=(x*y)/((sqrt(x*y+1))-1);L=limit(limit(f,x,0),y,1)

L=

2

(3)

>>symsxy;f=(1-cos(x^2+y^2))/((x^2+y^2)*exp(x^2+y^2));L=limit(limit(f,x,0),y,0)

L=

0

8、已知参数方程

,试求出

>>symst;x=log(cos(t));y=cos(t)-t*sin(t);

diff(y,t)/diff(x,t)

ans=

-(-2*sin(t)-t*cos(t))/sin(t)*cos(t)

>>f=diff(y,t,2)/diff(x,t,2);subs(f,t,sym(pi)/3)

ans=

3/8-1/24*pi*3^(1/2)

 

9、假设

,试求

>>symsxyt

f=int(exp(-t^2),t,0,x*y);

x/y*diff(f,x,2)-2*diff(diff(f,x),y)+diff(f,y,2)

simple(ans)

ans=

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

simplify:

-2*exp(-x^2*y^2)*(-x^2*y^2+1+x^3*y)

radsimp:

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

combine(trig):

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

factor:

-2*exp(-x^2*y^2)*(-x^2*y^2+1+x^3*y)

expand:

2*x^2*y^2/exp(x^2*y^2)-2/exp(x^2*y^2)-2*x^3*y/exp(x^2*y^2)

combine:

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

convert(exp):

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

convert(sincos):

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

convert(tan):

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

collect(x):

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

mwcos2sin:

2*x^2*y^2*exp(-x^2*y^2)-2*exp(-x^2*y^2)-2*x^3*y*exp(-x^2*y^2)

ans=

-2*exp(-x^2*y^2)*(-x^2*y^2+1+x^3*y)

10、试求出下面的极限。

(1)

>>symskn;symsum(1/((2*k)^2-1),k,1,inf)

ans=

1/2

(2)

>>symskn

limit(n*symsum(1/(n^2+k*pi),k,1,n),n,inf)

ans=

1

11、试求出以下的曲线积分。

(1)

为曲线

symsat;x=a*(cos(t)+t*sin(t));y=a*(sin(t)-t*cos(t));

f=x^2+y^2;I=int(f*sqrt(diff(x,t)^2+diff(y,t)^2),t,0,2*pi)

I=

2*csgn(a)*a^3*pi^2+4*csgn(a)*a^3*pi^4

(2)

,其中

正向上半椭圆。

>>symsxyabct;x=c*cos(t)/a;y=c*sin(t)/b;

P=y*x^3+exp(y);Q=x*y^3+x*exp(y)-2*y;

ds=[diff(x,t);diff(y,t)];I=int([PQ]*ds,t,0,pi)

I=

-2/15*c*(-2*c^4+15*b^4)/b^4/a

12、试求出Vandermonde矩阵

的行列式,并以最简的形式显示结果。

>>symsabcde;A=vander([abcde])

A=

[a^4,a^3,a^2,a,1]

[b^4,b^3,b^2,b,1]

[c^4,c^3,c^2,c,1]

[d^4,d^3,d^2,d,1]

[e^4,e^3,e^2,e,1]

det(A),simple(ans)

ans=

(c-d)*(b-d)*(b-c)*(a-d)*(a-c)*(a-b)*(-d+e)*(e-c)*(e-b)*(e-a)

13、试对矩阵

进行Jordan变换,并得出变换矩阵。

>>A=[-2,0.5,-0.5,0.5;0,-1.5,0.5,-0.5;2,0.5,-4.5,0.5;2,1,-2,-2];

[VJ]=jordan(sym(A))

V=

[0,1/2,1/2,-1/4]

[0,0,1/2,1]

[1/4,1/2,1/2,-1/4]

[1/4,1/2,1,-1/4]

J=

[-4,0,0,0]

[0,-2,1,0]

[0,0,-2,1]

[0,0,0,-2]

14、试用数值方法和解析方法求取下面的Sylvester方程,并验证得出的结果。

 

15、假设已知矩阵

如下,试求出

>>A=[-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-2.5,1.5;0,-1,-1,-3];

A=sym(A);symst;

expm(A*t)

ans=

[1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*exp(-5*t)+1/2*t^2*exp(-3*t),1/2*exp(-5*t)-1/2*exp(-3*t)+t*exp(-3*t),1/2*t*exp(-3*t)+1/2*t^2*exp(-3*t),1/2*exp(-5*t)-1/2*exp(-3*t)-1/2*t*exp(-3*t)+1/2*t^2*exp(-3*t)]

[1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t),1/2*exp(-3*t)+1/2*exp(-5*t),1/2*t*exp(-3*t),1/2*t*exp(-3*t)+1/2*exp(-5*t)-1/2*exp(-3*t)]

[1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t),-1/2*exp(-5*t)+1/2*exp(-3*t),exp(-3*t)+1/2*t*exp(-3*t),1/2*t*exp(-3*t)-1/2*exp(-5*t)+1/2*exp(-3*t)]

[-1/2*t^2*exp(-3*t),-t*exp(-3*t),-1/2*t^2*exp(-3*t)-t*exp(-3*t),exp(-3*t)-1/2*t^2*exp(-3*t)]

 

>>A=[-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-2.5,1.5;0,-1,-1,-3];

A=sym(A);symsxt;sin(A*t)

ans=

[-sin(9/2*t),0,sin(1/2*t),-sin(3/2*t)]

[-sin(1/2*t),-sin(4*t),sin(1/2*t),-sin(1/2*t)]

[sin(3/2*t),sin(t),-sin(5/2*t),sin(3/2*t)]

[0,-sin(t),-sin(t),-sin(3*t)]

 

>>A=[-4.5,0,0.5,-1.5;-0.5,-4,0.5,-0.5;1.5,1,-2.5,1.5;0,-1,-1,-3];

A=sym(A);symsxt;exp(A*t)*sin(A^2*exp(A*t)*t)

ans=

[exp(-9/2*t)*sin(t*(21*exp(-9/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12))+sin(t*(5*exp(-9/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5))+exp(1/2*t)*sin(t*(-11*exp(-9/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11))+exp(-3/2*t)*sin(t*(-exp(-9/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8)),exp(-9/2*t)*sin(t*(21+2*exp(-4*t)-2*exp(t)+12*exp(-t)))+sin(t*(5+17*exp(-4*t)-3*exp(t)+5*exp(-t)))+exp(1/2*t)*sin(t*(-11-8*exp(-4*t)+6*exp(t)-11*exp(-t)))+exp(-3/2*t)*sin(t*(-1+6*exp(-4*t)+5*exp(t)+8*exp(-t))),exp(-9/2*t)*sin(t*(23*exp(1/2*t)-2*exp(-5/2*t)+12*exp(-t)))+sin(t*(22*exp(1/2*t)-3*exp(-5/2*t)+5*exp(-t)))+exp(1/2*t)*sin(t*(-19*exp(1/2*t)+6*exp(-5/2*t)-11*exp(-t)))+exp(-3/2*t)*sin(t*(5*exp(1/2*t)+5*exp(-5/2*t)+8*exp(-t))),exp(-9/2*t)*sin(t*(21*exp(-3/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12*exp(-3*t)))+sin(t*(5*exp(-3/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5*exp(-3*t)))+exp(1/2*t)*sin(t*(-11*exp(-3/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11*exp(-3*t)))+exp(-3/2*t)*sin(t*(-exp(-3/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8*exp(-3*t)))]

[exp(-1/2*t)*sin(t*(21*exp(-9/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12))+exp(-4*t)*sin(t*(5*exp(-9/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5))+exp(1/2*t)*sin(t*(-11*exp(-9/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11))+exp(-1/2*t)*sin(t*(-exp(-9/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8)),exp(-1/2*t)*sin(t*(21+2*exp(-4*t)-2*exp(t)+12*exp(-t)))+exp(-4*t)*sin(t*(5+17*exp(-4*t)-3*exp(t)+5*exp(-t)))+exp(1/2*t)*sin(t*(-11-8*exp(-4*t)+6*exp(t)-11*exp(-t)))+exp(-1/2*t)*sin(t*(-1+6*exp(-4*t)+5*exp(t)+8*exp(-t))),exp(-1/2*t)*sin(t*(23*exp(1/2*t)-2*exp(-5/2*t)+12*exp(-t)))+exp(-4*t)*sin(t*(22*exp(1/2*t)-3*exp(-5/2*t)+5*exp(-t)))+exp(1/2*t)*sin(t*(-19*exp(1/2*t)+6*exp(-5/2*t)-11*exp(-t)))+exp(-1/2*t)*sin(t*(5*exp(1/2*t)+5*exp(-5/2*t)+8*exp(-t))),exp(-1/2*t)*sin(t*(21*exp(-3/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12*exp(-3*t)))+exp(-4*t)*sin(t*(5*exp(-3/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5*exp(-3*t)))+exp(1/2*t)*sin(t*(-11*exp(-3/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11*exp(-3*t)))+exp(-1/2*t)*sin(t*(-exp(-3/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8*exp(-3*t)))]

[exp(3/2*t)*sin(t*(21*exp(-9/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12))+exp(t)*sin(t*(5*exp(-9/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5))+exp(-5/2*t)*sin(t*(-11*exp(-9/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11))+exp(3/2*t)*sin(t*(-exp(-9/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8)),exp(3/2*t)*sin(t*(21+2*exp(-4*t)-2*exp(t)+12*exp(-t)))+exp(t)*sin(t*(5+17*exp(-4*t)-3*exp(t)+5*exp(-t)))+exp(-5/2*t)*sin(t*(-11-8*exp(-4*t)+6*exp(t)-11*exp(-t)))+exp(3/2*t)*sin(t*(-1+6*exp(-4*t)+5*exp(t)+8*exp(-t))),exp(3/2*t)*sin(t*(23*exp(1/2*t)-2*exp(-5/2*t)+12*exp(-t)))+exp(t)*sin(t*(22*exp(1/2*t)-3*exp(-5/2*t)+5*exp(-t)))+exp(-5/2*t)*sin(t*(-19*exp(1/2*t)+6*exp(-5/2*t)-11*exp(-t)))+exp(3/2*t)*sin(t*(5*exp(1/2*t)+5*exp(-5/2*t)+8*exp(-t))),exp(3/2*t)*sin(t*(21*exp(-3/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12*exp(-3*t)))+exp(t)*sin(t*(5*exp(-3/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5*exp(-3*t)))+exp(-5/2*t)*sin(t*(-11*exp(-3/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11*exp(-3*t)))+exp(3/2*t)*sin(t*(-exp(-3/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8*exp(-3*t)))]

[sin(t*(21*exp(-9/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12))+exp(-t)*sin(t*(5*exp(-9/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5))+exp(-t)*sin(t*(-11*exp(-9/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11))+exp(-3*t)*sin(t*(-exp(-9/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8)),sin(t*(21+2*exp(-4*t)-2*exp(t)+12*exp(-t)))+exp(-t)*sin(t*(5+17*exp(-4*t)-3*exp(t)+5*exp(-t)))+exp(-t)*sin(t*(-11-8*exp(-4*t)+6*exp(t)-11*exp(-t)))+exp(-3*t)*sin(t*(-1+6*exp(-4*t)+5*exp(t)+8*exp(-t))),sin(t*(23*exp(1/2*t)-2*exp(-5/2*t)+12*exp(-t)))+exp(-t)*sin(t*(22*exp(1/2*t)-3*exp(-5/2*t)+5*exp(-t)))+exp(-t)*sin(t*(-19*exp(1/2*t)+6*exp(-5/2*t)-11*exp(-t)))+exp(-3*t)*sin(t*(5*exp(1/2*t)+5*exp(-5/2*t)+8*exp(-t))),sin(t*(21*exp(-3/2*t)+2*exp(-1/2*t)-2*exp(3/2*t)+12*exp(-3*t)))+exp(-t)*sin(t*(5*exp(-3/2*t)+17*exp(-1/2*t)-3*exp(3/2*t)+5*exp(-3*t)))+exp(-t)*sin(t*(-11*exp(-3/2*t)-8*exp(-1/2*t)+6*exp(3/2*t)-11*exp(-3*t)))+exp(-3*t)*sin(t*(-exp(-3/2*t)+6*exp(-1/2*t)+5*exp(3/2*t)+8*exp(-3*t)))]

第二部分数学问题求解与数据处理(4学时)

主要内容:

掌握代数方程与最优化问题、微分方程问题、数据处理问题的MATLAB求解方法。

练习题:

1、对下列的函数

进行Laplace变换。

(1)

(2)

;(3)

(1)>>symsat;f=sin(a*t)/t;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 历史学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1