矩阵计算习题及答案.docx

上传人:b****2 文档编号:1227042 上传时间:2023-04-30 格式:DOCX 页数:15 大小:101.75KB
下载 相关 举报
矩阵计算习题及答案.docx_第1页
第1页 / 共15页
矩阵计算习题及答案.docx_第2页
第2页 / 共15页
矩阵计算习题及答案.docx_第3页
第3页 / 共15页
矩阵计算习题及答案.docx_第4页
第4页 / 共15页
矩阵计算习题及答案.docx_第5页
第5页 / 共15页
矩阵计算习题及答案.docx_第6页
第6页 / 共15页
矩阵计算习题及答案.docx_第7页
第7页 / 共15页
矩阵计算习题及答案.docx_第8页
第8页 / 共15页
矩阵计算习题及答案.docx_第9页
第9页 / 共15页
矩阵计算习题及答案.docx_第10页
第10页 / 共15页
矩阵计算习题及答案.docx_第11页
第11页 / 共15页
矩阵计算习题及答案.docx_第12页
第12页 / 共15页
矩阵计算习题及答案.docx_第13页
第13页 / 共15页
矩阵计算习题及答案.docx_第14页
第14页 / 共15页
矩阵计算习题及答案.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

矩阵计算习题及答案.docx

《矩阵计算习题及答案.docx》由会员分享,可在线阅读,更多相关《矩阵计算习题及答案.docx(15页珍藏版)》请在冰点文库上搜索。

矩阵计算习题及答案.docx

矩阵计算习题及答案

1、选择题

1)下列变量中是合法的。

A.Char_l,i,j*y,C.X\y,al234D.end,lbcd

2)下列C是合法的常量。

A.3el0B.le500C.D.10-2

3)

x=uint8,则x所占的字节是D个。

4)已知x=0:

10,则x有B个元素。

5)产生对角线元素全为1其余为0的2X3矩阵的命令是

有元素

23、

8)a=456,则运行命令mean(a)是。

<789丿

A.计算a的平均值B.计算a每列的平均值

9)己知x是一个向量,计算ln(x)的命令是B。

A.In(x)B.log(x)C.Ln(x)D.lglO(x)

10)当a二时,使用取整函数得到3,则该函数名是o

B.roundC.ceilD.floor

11)己知a二0:

4,b=l:

5,下面的运算表达式出错的是D。

A.a+bB.a./bC.a'*bD.a*b

12)已知a=4,b='4',下面说法错误的是o

A.变量a比变量b占用的空间大B.变量a、b可以进行加减乘除运算

C.变量a、b数据类型相同D.变量b可以用eval计算

13)己知s二'显示“hell。

”',则s元素的个数是o

A.12B.9C.7D.18

14)运行字符串函数strncmp('si','s2',2),贝!

|结果为B。

A.1B.0C.trueD.fales

15)命令day(now)是指。

A.按日期字符串格式提取当前时间B.提取当前时间

C.提取当前时间的日期D.按日期字符串格式提取当前

日期

16)有一个2行2列的元胞数组c,则c

(2)是指D°

A.第1行第2列元素内容B.第2行第1列元素内容

C.第1行第2列元素D.第2行第1列元素

17)以下运算中哪个运算级别最高Bo

18)运行命令bitand(20,15)的结果是C°

A.15B.20C.4D.5

19)使用检测函数isinteger(15)的结果是B。

A.1B.0C・trueD.fales

20)计算三个多项式si、s2和s3的乘积,则算式为C。

A.conv(si,s2,s3)B.sl*s2*s3C.conv(conv(sl,s2),s3)D.conv(sl*s2*s3)

以下写出MATLAB命令序列,并给出结果

2.复数向量a=2+3i,b=3-4i,计算a+b,a-b,c=a*b,d=a/b,并计算变量c

的实部、虚部、模和相角。

»c=a*b%bywl

»imag(c)%bywl

»a=2+3i;b=3-4i;%bywl

»a+b%bywl

c=

ans=

18.0000+I.OOOOi

1

ans=

»d=a/b%bywl

»abs(c)%bywl

5.0000-I.OOOOi

d=

ans=

»a-b%bywl

-0.2400+0.6800i

18.0278

ans=

»r©al(c)%bywl

»angle(c)%bywl

ans=

ans=

-1.0000+7.0000i

18

O0555

3.用from:

step:

to的方式和linspace函数分别得到0、4只步长为开的

变量xl,0'4开分成10个点的变量x2。

 

‘123、

4.输入矩阵a二456,使用全下标方式提取元素3,使用单下标方式提、789丿

取元素8,取出后两行子矩阵块,使用逻辑矩阵提取]3\

»a(2:

3,:

»a=[123;456;789]%bywl

5.输入a为3X3的魔方阵,b为3X3的单位阵,将他们生成3X6的大

矩阵c、6X3的大矩阵d,将d的最后一行提取生成小矩阵e。

>>a=magic(3)%bywl

»c=[a,b]%bywl»d=[a;b]%bywl

a=

816

357

492

»b=eye(3)%bywlb=

100

010

001

c=

d=

816

Columns1through535?

492

8161

0100

3570

1010

4920

0001

Column6»d(end;)%bywl

0ans=

0

001

6.矩阵a二4

<7

23、

56用flipud、fliplr、rot90>diag、triu和tril进行

89.

操作。

并求其转置、秩、逆矩阵、矩阵的行列式值及三次幕。

»a=reshape(1:

9,3,3);%bywl>>a=a*

a=

123

456

789

»a=reshape(1:

9,3,3);%bywl»a=a*%bywl

a=

123

456

789

>>fliplr(a)%bywlans=

321

654

987

»rot90(a)%bywl

ans=

258

147

»diag(a)

%bywl

 

ans=

123

056

009

»tril(a)%bywl

ans二

147

258

369

»rank(a)%bywlans=

2

ans=

1

0

0

4

5

0

7

8

9

»inv(a)%bywl

Warning:

Matrixisclosetosingularorbadlyscaled

Resultsmaybeinaccurate.RCOND=1.541976e-018.

ans=

»a=[13;58];%bywl

»a*%bywl

»det(a)%bywl

ans=

6.6613e-016

»a^3

1.0e+01G•

045040.9007-0.4504

090D7-1801409007

-0.45040.9007-0.4504

ans=

468576

10621305

16562034

»^3%bywl

684

1548

2412

ans=

468576684

106213051648

165620342412

2召一3x2+x3+2x4=8

 

8•解线性方程组]

X]+3x2+x4=6

x{-x2+x3+8x4=7

lx{+3兀2—2小+2x4=5

»A=[2-312;1301;1-118;71-22]%bywl

2-312

1301

118

71-22»b=[8;6;7;5]%bywl

8

6

7

5»x=inv(Afb%bywl

2.5353

1.2033

6.8299

-0.1462

9.输入字符串变量a为,hen。

',将其每个字符后移4个,如'h,变为

'1',然后再逆丿子存入变量b。

»a-hello*;%bywl

»b=char(fliplr(double(a)+4))%bywl

b=

sppil

10计算函数/(0=10f2r-sin(4/),其中t范围为0到20,步长为,g(t)为f(t)大于0的部分,计算g(t)的值。

»t=0:

0.2:

20;%bywl

»f=10*exp(2*t)-sin(4*t)%bywl

 

1.0e+018*

Columns1through6

0.00000.00000.0000

Columns7through12

0.00000.00000.0000

Columns13through18

0.00000.00000.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

 

Columns19through24

0.00000.00000.00000.00000.00000.0000

 

Columns25through30

0.00000.00000.0000

Columns31through36

0.00000.00000.0000

Columns37through42

0.00000.00000.0000

Columns43through48

0.00000.00000.0000

Columns49through54

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

 

0.00000.00000.00000.00000.00000.0000

Columns55through60

0.00000.00000.0000

Columns61through66

0.00000.00000.0000

Columns67through72

0.00000.00000.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

 

Columns73through78

 

0.00000.00000.0001

0.00010.00020.0002

 

Columns79through84

0.00040.00050.00080.00120.00180.0026

Columns85through90

0.00390.00580.0087

0.0130

0.0194

0.0289

Columns91through96

0.04310.06430.0959

0.1431

0.2135

0.3186

Columns97through101

0.47520.70901.0577

1.5778

2.3539

»f1=f(f>=0)%bywl

f1=

1.0e+018*

Columns1through6

0.00000.00000.0000

0.0000

0.0000

0.0000

Columns7through12

 

0.00000.00000.0000

Columns13through18

0.00000.00000.0000

Columns19through24

0.00000.00000.0000

Columns25through30

0.00000.00000.0000

Columns31through36

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

 

0.00000.00000.00000.00000.00000.0000

Columns37through42

0.00000.00000.0000

Columns43through48

0.00000.00000.0000

Columns49through54

0.00000.00000.0000

Columns55through60

0.00000.00000.0000

Columns61through66

0.00000.00000.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

0.0000

 

Columns67through72

0.00000.00000.00000.00000.00000.0000

 

Columns73through78

0.00000.00000.0001

Columns79through84

0.00040.00050.0008

Columns85through90

0.00390.00580.0087

Columns91through96

0.04310.06430.0959

Columns97through101

0.47520.70901.0577

0.0001

0.0002

0.0002

0.0012

0.0018

0.0026

0.0130

0.0194

0.0289

0.1431

0.2135

0.3186

1.5778

2.3539

(\23、

11.矩阵a二456,使用数组信息获取函数求其行列数、元素个数,是

<789,

否为稀疏矩阵、是否为字符型。

»a=reshape(1:

9,3,3);a=al%buwl

a=

123

456

789

»size(a)%bywlans=

33

»numel(a)%bywl

»issparse(a)%bywl

ans=

0

»ischar(a)%bywl

ans=

ans=

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

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2