Matlab实验报告终极版Word文档格式.docx

上传人:b****6 文档编号:20526179 上传时间:2023-01-23 格式:DOCX 页数:57 大小:612.43KB
下载 相关 举报
Matlab实验报告终极版Word文档格式.docx_第1页
第1页 / 共57页
Matlab实验报告终极版Word文档格式.docx_第2页
第2页 / 共57页
Matlab实验报告终极版Word文档格式.docx_第3页
第3页 / 共57页
Matlab实验报告终极版Word文档格式.docx_第4页
第4页 / 共57页
Matlab实验报告终极版Word文档格式.docx_第5页
第5页 / 共57页
点击查看更多>>
下载资源
资源描述

Matlab实验报告终极版Word文档格式.docx

《Matlab实验报告终极版Word文档格式.docx》由会员分享,可在线阅读,更多相关《Matlab实验报告终极版Word文档格式.docx(57页珍藏版)》请在冰豆网上搜索。

Matlab实验报告终极版Word文档格式.docx

X=0.4000-1.40003.6000

01.5000-2.5000

Y=B\A'

Y=-0.95001.3500

0.5500-0.1500

0.9000-0.7000

3、输入A=[715;

256;

315],B=[111;

222;

333],在命令窗口中执行下列表达式,掌握其含义:

答:

A(2,3)%矩阵A第二行第三列的元素

A(:

2)%矩阵A第二列的数据

A(3,:

)%矩阵A第二行的数据

1:

2:

3)%矩阵A第一列和第三列的数据

3).*B(:

2)%矩阵A的第三列和矩阵B的第二列点乘

3)*B(2,:

)%矩阵A的第三列和矩阵B的第二行相乘

A*B%矩阵A和矩阵B相乘

A.*B%矩阵A和矩阵B点乘

A^2%矩阵A的乘方

A.^2%矩阵A的点乘方

B/A%矩阵B右除矩阵A

B./A%矩阵B点除矩阵A

A=[715;

256;

315];

B=[111;

333];

A(2,3)

ans=6

A(:

2)

ans=1

5

1

A(3,:

ans=315

3)

ans=75

26

35

2)

ans=5

12

15

ans=101010

121212

101010

A*B

ans=242424

303030

202020

A.*B

ans=715

41012

9315

A^2

ans=661766

423370

381346

A.^2

ans=49125

42536

9125

B/A

ans=0.18420.2105-0.2368

0.36840.4211-0.4737

0.55260.6316-0.7105

B./A

ans=0.14291.00000.2000

1.00000.40000.3333

1.00003.00000.6000

4、输入C=1:

20,则C(i)表示什么?

其中i=1,2,3,…,10;

C=1:

20

C=135791113151719

C(i)

下标索引必须为正整数类型或逻辑类型。

C

(1)

C

(2)

ans=3

C(3)

C(4)

ans=7

C(5)

ans=9

C(6)

ans=11

C(7)

ans=13

C(8)

ans=15

C(9)

ans=17

C(10)

ans=19

5、先求下列表达式的值,然后显示Matlab工作空间的使用情况并保存全部变量。

(1)

(2)

,其中

(3)

提示:

利用冒号表达式生成a向量,求各点的函数值时用点乘运算。

(1)>

z1=2*sin(85/360)/(1+(exp

(1))^2)

z1=0.0558

x=[21+2*i;

-0.455]

x=2.0000+0.0000i1.0000+2.0000i

-0.4500+0.0000i5.0000+0.0000i

(2)>

z2=(log(x+sqrt(1+x^2)))/2

z2=0.7114-0.0253i0.8968+0.3658i

0.2139+0.9343i1.1541-0.0044i

(3)>

a=[-3:

0.1:

3]

a=Columns1through9

-3.0000-2.9000-2.8000-2.7000-2.6000-2.5000-2.4000-2.3000-2.2000

Columns10through18

-2.1000-2.0000-1.9000-1.8000-1.7000-1.6000-1.5000-1.4000-1.3000

Columns19through27

-1.2000-1.1000-1.0000-0.9000-0.8000-0.7000-0.6000-0.5000-0.4000

Columns28through36

-0.3000-0.2000-0.100000.10000.20000.30000.40000.5000

Columns37through45

0.60000.70000.80000.90001.00001.10001.20001.30001.4000

Columns46through54

1.50001.60001.70001.80001.90002.00002.10002.20002.3000

Columns55through61

2.40002.50002.60002.70002.80002.90003.0000

m1=linspace(0.3,0.3,61)

m1=Columns1through9

0.30000.30000.30000.30000.30000.30000.30000.30000.3000

Columns28through36

0.30000.30000.30000.30000.30000.30000.3000

m2=linspace(-0.3,-0.3,61)

m2=Columns1through9

-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000

-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000

-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000-0.3000

z2=(power(exp

(1),m1.*a)-power(exp

(1),m2.*a))/2.*sin(a+m1)+log((a+m1)/2)

z2=Columns1through4

0.7388+3.1416i0.7696+3.1416i0.7871+3.1416i0.7913+3.1416i

Columns5through8

0.7822+3.1416i0.7602+3.1416i0.7254+3.1416i0.6784+3.1416i

Columns9through12

0.6196+3.1416i0.5496+3.1416i0.4688+3.1416i0.3780+3.1416i

Columns13through16

0.2775+3.1416i0.1680+3.1416i0.0497+3.1416i-0.0771+3.1416i

Columns17through20

-0.2124+3.1416i-0.3566+3.1416i-0.5104+3.1416i-0.6752+3.1416i

Columns21through24

-0.8536+3.1416i-1.0497+3.1416i-1.2701+3.1416i-1.5271+3.1416i

Columns25through28

-1.8436+3.1416i-2.2727+3.1416i-2.9837+3.1416i-37.0245+0.0000i

Columns29through32

-3.0017+0.0000i-2.3085+0.0000i-1.8971+0.0000i-1.5978+0.0000i

Columns33through36

-1.3575+0.0000i-1.1531+0.0000i-0.9723+0.0000i-0.8083+0.0000i

Columns37through40

-0.6567+0.0000i-0.5151+0.0000i-0.3819+0.0000i-0.2561+0.0000i

Columns41through44

-0.1374+0.0000i-0.0255+0.0000i0.0792+0.0000i0.1766+0.0000i

Columns45through48

0.2663+0.0000i0.3478+0.0000i0.4206+0.0000i0.4841+0.0000i

Columns49through52

0.5379+0.0000i0.5815+0.0000i0.6145+0.0000i0.6366+0.0000i

Columns53through56

0.6474+0.0000i0.6470+0.0000i0.6351+0.0000i0.6119+0.0000i

Columns57through60

0.5777+0.0000i0.5327+0.0000i0.4774+0.0000i0.4126+0.0000i

Column61

0.3388+0.0000i

6、已知:

求下列表达式的值。

,其中I为单位矩阵;

(4)

(5)

A=[1234-4;

34787;

3657];

B=[13-1;

203;

3-27];

A+6*B

ans=1852-10

467105

215349

I=eye(3);

A-B+I

ans=1231-3

32884

0671

A*B

ans=684462

309-72596

154-5241

A.*B

ans=121024

680261

9-13049

A^3

ans=3722623382448604

247370149188600766

78688454142118820

A.^3

ans=172839304-64

39304343658503

27274625343

A/B

ans=16.4000-13.60007.6000

35.8000-76.200050.2000

67.0000-134.000068.0000

A\B

ans=-0.03130.3029-0.3324

0.0442-0.03230.1063

0.0317-0.11580.1558

[A,B]

ans=1234-413-1

34787203

36573-27

[A([1,3],:

);

B^2]

ans=1234-4

3657

451

11019

20-540

 

实验二Matlab的数值计算和符号运算

一、上机验证实验

A、开启PC机,进入MATLAB语言

B、帮助命令的使用,查找sqrt函数的使用方法

helpsqrt

sqrt-Squareroot

ThisMATLABfunctionreturnsthesquarerootofeachelementofthearrayX.

B=sqrt(X)

C、矩阵运算

(1)已知A=[12;

34];

B=[55;

78];

求A^2*B

ans=105115

229251

(2)矩阵除法。

已知A=[123;

456;

789];

B=[100;

020;

003];

求A/B,A\B

A=[123;

A/B

ans=1.00001.00001.0000

4.00002.50002.0000

7.00004.00003.0000

A\B

警告:

矩阵接近奇异值,或者缩放错误。

结果可能不准确。

RCOND=1.541976e-18。

ans=1.0e+16*

-0.45041.8014-1.3511

0.9007-3.60292.7022

(3)矩阵的转置及共轭转置。

已知A=[15+i,2-i,1;

6*i,4,9-i];

求A.'

,A'

A=[15+i,2-i,1;

A.'

ans=15.0000+1.0000i0.0000+6.0000i

2.0000-1.0000i4.0000+0.0000i

1.0000+0.0000i9.0000-1.0000i

A'

ans=15.0000-1.0000i0.0000-6.0000i

2.0000+1.0000i4.0000+0.0000i

1.0000+0.0000i9.0000+1.0000i

(4)使用冒号选出指定元素。

求A中第3列前2个元素;

A中所有第2行的元素;

A=[123;

A(1:

2,3)

6

A(2,1:

ans=456

(5)方括号[]。

用magic函数生成一个4阶魔术矩阵,删除该矩阵的第四列。

A=magic(4)

A=162313

511108

97612

414151

A(:

4)=[]

A=1623

51110

976

41415

D、多项式

(1)求多项式

的根

P=[1,0,-2,-4];

roots(P)

ans=2.0000+0.0000i

-1.0000+1.0000i

-1.0000-1.0000i

(2)已知A=[1.2350.9;

51.756;

3901;

1234],求矩阵A的特征多项式;

A=[1.2350.9;

1234];

B=poly(A)

B=1.0000-6.9000-77.2600-86.1300604.5500

(3)P(s)=1.0000s^4-6.9000s^3-77.2600s^2-86.1300s+604.5500

求矩阵多项式中未知数为20时的值;

C=polyval(B,20)

C=7.2778e+04

(4)把矩阵A作为未知数代入到多项式中;

D=polyval(B,A)

D=1.0e+03*

0.3801-0.4545-1.99510.4601

-1.99510.2093-1.9951-2.8880

-0.4545-4.89780.60450.4353

0.43530.0841-0.4545-1.1617

2.上机练习实验

(1)利用help检查roots指令的使用方法,然后求4x^4-3x^3+2x^2-x+1=0的所有根。

helproots

roots-Polynomialroots

ThisMATLABfunctionreturnsacolumnvectorwhoseelementsaretherootsofthe

polynomialc.

r=roots(c)

P=[4,-3,2,-1,1];

ans=0.5917+0.4864i

0.5917-0.4864i

-0.2167+0.6158i

-0.2167-0.6158i

(2)令A是一个维度mxn的矩陣.解释max(A)和min(max(A))分別是什么意思?

max(A):

表示由A矩阵每一列最大值组成的一横向量;

min(max(A)):

表示得到的横向量之中的最小值。

>

A=rand(3,4)

A=0.81470.91340.27850.9649

0.90580.63240.54690.1576

0.12700.09750.95750.9706

max(A)

ans=0.90580.91340.95750.9706

min(max(A))

ans=0.9058

(3)令x是一个维度n的向量.解释find(x>

0.8*max(x))是什么意思?

find(x>

0.8*max(x))的意思是从向量中找出大于最大值0.8倍的所有数据得位置。

x=[1;

2;

3;

4;

5;

6];

a=find(x>

0.8*max(x))

a=

(4)令x=[2356]和y=-1:

2而z=x.^y,解释z的值是什么?

x=[2356];

y=-1:

2

y=-1012

z=x.^y

z=0.50001.00005.000036.0000

(5)试用解析解和数值解的方法求解微分方程

x"

(t)=-2x(t)-3x'

(t)+exp(-5t)

y"

(t)=2x(t)-3y(t)-4x'

(t)-4y'

(t)-sint

x(0)=1,x'

(0)=2,y(0)=3,y'

(0)=4

解析解:

[x,y]=dsolve('

D2x=(-2)*x-3*Dx+exp(-5*t),D2y=2*x-3*y-4*Dx-4*Dy-sint'

'

x(0

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

当前位置:首页 > 人文社科 > 军事政治

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

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