MATLAB第二章实验报告.docx

上传人:b****5 文档编号:7431346 上传时间:2023-01-23 格式:DOCX 页数:27 大小:21.12KB
下载 相关 举报
MATLAB第二章实验报告.docx_第1页
第1页 / 共27页
MATLAB第二章实验报告.docx_第2页
第2页 / 共27页
MATLAB第二章实验报告.docx_第3页
第3页 / 共27页
MATLAB第二章实验报告.docx_第4页
第4页 / 共27页
MATLAB第二章实验报告.docx_第5页
第5页 / 共27页
点击查看更多>>
下载资源
资源描述

MATLAB第二章实验报告.docx

《MATLAB第二章实验报告.docx》由会员分享,可在线阅读,更多相关《MATLAB第二章实验报告.docx(27页珍藏版)》请在冰豆网上搜索。

MATLAB第二章实验报告.docx

MATLAB第二章实验报告

MATLAB

数据及基本操作

班级:

11电信一班

姓名:

何得中

学号:

20111060108

实验目的:

1.熟悉MATLAB的组体成体系及工作环境;

2.了解MATLAB的帮助系统;

3.掌握MATLAB的数据类型及变量的基本操作;

4.掌握矩阵建立的基本方法及其运算;

5.掌握矩阵索引与分析方法;

6.熟悉字符串单元及结构数据的建立及基本操作。

实验仪器:

MATLAB软件,电脑

实验数据:

>>A=[123;456;789]

A=123

456

789

>>A=[123

456

789]

A=123

456

789

>>x=0:

pi/8:

2*pi;

>>y=cos(x)

y=Columns1through10

1.00000.92390.70710.38270.0000-0.3827-0.7071-0.9239-1.0000-0.9239

Columns11through17

-0.7071-0.3827-0.00000.38270.70710.92391.0000

>>B=ones(3,5)

B=11111

11111

11111

>>zeros(3)

ans=000

000

000

>>C=rand(3,4)

C=0.95010.48600.45650.4447

0.23110.89130.01850.6154

0.60680.76210.82140.7919

>>D=randn(2,3)

D=-0.43260.1253-1.1465

-1.66560.28771.1909

>>eye(3)

ans=100

010

001

>>M=magic(4)

M=162313

511108

97612

414151

>>T=toeplitz(1:

5,1:

6)

T=123456

212345

321234

432123

543212

>>H=hilb(5)

H=1.00000.50000.33330.25000.2000

0.50000.33330.25000.20000.1667

0.33330.25000.20000.16670.1429

0.25000.20000.16670.14290.1250

0.20000.16670.14290.12500.1111

>>a=3:

18

a=3456789101112131415161718

>>b=1:

0.2:

6

b=Columns1through9

1.00001.20001.40001.6001.80002.00002.20002.40002.6000

Columns10through18

2.80003.00003.20003.40003.60003.80004.00004.20004.4000

Columns19through26

4.60004.80005.00005.20005.40005.60005.80006.0000

>>linspace(1,15,10)

ans=Columns1through9

1.00002.55564.11115.66677.22228.777810.333311.888913.4444

Column10

15.0000

>>y=[0.90.30.40.10.50.60.2];

>>[sorted,index]=sort(y)

sorted=0.10000.20000.30000.40000.50000.60000.9000

index=4723561

>>A=rand(4,5)

A=0.92180.93550.05790.13890.2722

0.73820.91690.35290.20280.1988

0.17630.41030.81320.19870.0153

0.40570.89360.00990.60380.7468

>>[a,b]=min(A)

a=0.17630.41030.00990.13890.0153

b=33413

>>min(A(:

))

ans=0.0099

>>V=[1234]

V=1234

>>norm(V,2)

ans=5.4772

>>norm(V,1)

ans=10

>>norm(V,inf)

ans=4

>>V=[256849]

V=256849

>>min(V)

ans=2

>>V=[496;789;456]

V=496

789

456

>>min(V)

ans=456

>>max(V)

ans=799

>>mean(V)

ans=5.00007.33337.0000

>>median(V)

ans=486

>>std(V)

ans=1.73212.08171.7321

>>diff(V)

ans=3-13

-3-3-3

>>sort(V)

ans=456

486

799

>>length(V)

ans=3

>>norm(V)

ans=19.9125

>>sum(V)

ans=152221

>>prod(V)

ans=112360324

>>cumsum(V)

ans=496

111715

152221

>>cumprod(V)

ans=496

287254

112360324

>>V=[128]

V=128

>>U=[3;4;7]

U=3

4

7

>>dot(V,U)

ans=67

>>cross(V,U)

ans=-1817-2

>>A=[564;789;456]

A=564

789

456

>>B=[627;758;468]

B=627

758

468

>>C=A-B

C=-14-3

031

0-1-2

>>C=A*B

C=8864115

134108185

8369116

>>C1=A\B

C1=0.6667-6.4444-7.6667

0.66674.88897.3333

-0.33331.22220.3333

>>C2=B/A

C2=-3.00008.3333-9.3333

-1.66675.5556-5.8889

0.0000-1.33333.3333

>>A=[123;456;789]

A=123

456

789

>>D=A^2

D=303642

668196

102126150

>>E=A^0.1

E=0.8466+0.2270i0.3599+0.0579i-0.0967-0.1015i

0.4015+0.0216i0.4525+0.0133i0.4432-0.0146i

-0.0134-0.1740i0.4848-0.0509i1.0132+0.0820i

>>A=[1+2*i3;42+i]

A=1.0000+2.0000i3.0000

4.00002.0000+1.0000i

>>A'

ans=1.0000-2.0000i4.0000

3.00002.0000-1.0000i

>>A=[123;456;789]

A=123

456

789

>>B=[346;798;5201]

B=346

798

521

>>C=A.*B

C=3818

284548

35169

>>D=A./B

D=0.33330.50000.5000

0.57140.55560.7500

1.40004.00009.0000

>>E=A.\B

E=3.00002.00002.0000

1.75001.80001.3333

0.71430.25000.1111

>>A=[1+2*i3;42+i]

A=1.0000+2.0000i3.0000

4.00002.0000+1.0000i

>>A.^2

ans=-3.0000+4.0000i9.0000

16.00003.0000+4.0000i

>>A.'

ans=1.0000+2.0000i4.0000

3.00002.0000+1.0000i

>>x=0.1:

0.1:

0.8

x=0.10000.20000.30000.40000.50000.60000.70000.8000

>>y=sin(2*x).*cos(2*x)

y=0.19470.35870.46600.49980.45460.33770.1675-0.0292

>>y=sin(x)

y=0.09980.19870.29550.38940.47940.56460.64420.7174

>>y=cos(x)

y=0.99500.98010.95530.92110.87760.82530.76480.6967

>>y=tan(x)

y=0.10030.20270.30930.42280.54630.68410.84231.0296

>>y=cot(x)

y=9.96664.93323.23272.36521.83051.46171.18720.9712

>>y=sec(x)

y=1.00501.02031.04681.08571.13951.21161.30751.4353

>>y=csc(x)

y=10.01675.03353.38392.56792.08581.77101.55231.3940

>>y=asin(x)

y=0.10020.20140.30470.41150.52360.64350.77540.9273

>>y=acos(x)

y=1.47061.36941.26611.15931.04720.92730.79540.6435

>>y=atan(x)

y=0.09970.19740.29150.38050.46360.54040.61070.6747

>>y=acot(x)

y=1.47111.37341.27931.19031.10711.03040.96010.8961

>>y=asec(x)

y=Columns1through6

0+2.9932i0+2.2924i0+1.8738i0+1.5668i0+1.3170i0+1.0986i

Columns7through8

0+0.8956i0+0.6931i

>>y=sinh(x)

y=0.10020.20130.30450.41080.52110.63670.75860.8881

>>y=cosh(x)

y=1.00501.02011.04531.08111.12761.18551.25521.3374

>>y=tanh(x)

y=0.09970.19740.29130.37990.46210.53700.60440.6640

>>y=coth(x)

y=10.03335.06653.43272.63192.16401.86201.65461.5059

>>y=sech(x)

y=0.99500.98030.95660.92500.88680.84360.79670.7477

>>y=csch(x)

y=9.98344.96683.28392.43461.91901.57071.31821.1260

>>y=asinh(x)

y=0.09980.19870.29570.39000.48120.56880.65270.7327

>>y=acosh(x)

y=Columns1through6

0+1.4706i0+1.3694i0+1.2661i0+1.1593i0+1.0472i0+0.9273i

Columns7through8

0+0.7954i0+0.6435i

>>y=atanh(x)

y=0.10030.20270.30950.42360.54930.69310.86731.0986

>>y=acoth(x)

y=Columns1through6

0.1003+1.5708i0.2027+1.5708i0.3095+1.5708i0.4236+1.5708i0.5493+1.5708i0.6931+1.5708i

Columns7through8

0.8673+1.5708i1.0986+1.5708i

>>y=asech(x)

y=2.99322.29241.87381.56681.31701.09860.89560.6931

>>y=acsch(x)

y=2.99822.31241.91891.64721.44361.28381.15451.0476

>>y=log(x)

y=-2.3026-1.6094-1.2040-0.9163-0.6931-0.5108-0.3567-0.2231

>>y=log10(x)

y=-1.0000-0.6990-0.5229-0.3979-0.3010-0.2218-0.1549-0.0969

>>y=log2(x)

y=-3.3219-2.3219-1.7370-1.3219-1.0000-0.7370-0.5146-0.3219

>>c=complex(a,b)

c=0.1763+3.0000i0.4103+3.0000i0.0099+4.0000i0.1389+1.0000i0.0153+3.0000i

>>zc=conj(x)

zc=0.10000.20000.30000.40000.50000.60000.70000.8000

>>b=imag(x)

b=00000000

>>a=real(x)

a=0.10000.20000.30000.40000.50000.60000.70000.8000

>>y=fix(x)

y=00000000

>>y=floor(x)

y=00000000

>>y=ceil(x)

y=11111111

>>y=round(x)

y=00001111

>>y=sign(x)

y=11111111

>>S=rats(x)

S=1/101/53/102/51/23/57/104/5

>>[N,D]=rat(x)

N=11321374

D=10510525105

>>A=[246;357;8109]

A=246

357

8109

>>B=[415;750;936]

B=415

750

936

>>A>B

ans=011

001

011

>>A

ans=100

100

100

>>A>=B

ans=011

011

011

>>A<=B

ans=100

110

100

>>A==B

ans=000

010

000

>>A~=B

ans=111

101

111

>>A&B

ans=111

110

111

>>A|B

ans=111

111

111

>>~A

ans=000

000

000

>>~B

ans=000

001

000

>>x=0:

pi/100:

3*pi;

>>y=sin(x);

>>plot(x,y);

>>y1=(x2*pi).*y;

>>figure,plot(x,y1);

>>r=(x>pi/3&x<2*pi/3)|(x>7*pi/3&8*pi/3);

>>rn=~r;

>>y2=r*sin(pi/3)+rn.*y1;

>>figure,plot(x,y2)

>>x=[045986748574858458]

x=045986748574858458

>>all(x)

ans=0

>>any(x)

ans=1

>>find(x)

ans=23456789101112131415

>>isempty(x)

ans=

0

>>isglobal(x)

Warning:

isglobalisobsoleteandwillbediscontinued.Type"helpisglobal"formoredetails.

ans=0

>>isinf(x)

ans=000000000000000

>>isnan(x)

ans=000000000000000

>>isfinite(x)

ans=111111111111111

>>issparse(x)

ans=0

>>isstr(x)

ans=0

>>not(x)

ans=100000000000000

>>y=[594678239812357956689005]

y=594678239812357956689005

>>y=[594678239812357956689005]

y=594678239812357956689005

>>x=[045986748574858458]

x=045986748574858458

>>A=[4-402;235017;182914]

A=4-402

235017

182914

>>[r,c]=find(A>=20&A<=30)

r=2

3

c=1

2

>>bitand(12,6)

ans=4

>>bitshift(12,1)

ans=24

>>bitxor(12,1)

ans=13

>>bitset(12,1)

ans=13

>>bitget(12,1)

ans=0

>>A=[8759568566211235626469889981]

A=8759568566211235626469889981

>>A

(2)

ans=59

>>A([1,2,8])

ans=875935

>>A([9,6,2])

ans=622159

>>A([end-4:

end])

ans=6469889981

>>A([1:

5,5:

-1:

1])

ans=87595685666685565987

>>A(3)=-1

A=8759-18566211235626469889981

>>A(15)=-8

A=8759-18566211235626469889981-8

>>A(20)=-1

A=Columns1through16

8759-18566211235626469889981-80

Columns17through20

000-1

>>A=rand(8)

A=0.95010.82140.93550.13890.44510.83810.30460.3784

0.23110.44470.91690.20280.93180.01960.18970.8600

0.60680.61540.41030.19870.46600.68130.19340.8537

0.48600.79190.89360.60380.41860.37950.68220.5936

0.89130.92180.05790.27220.84620.83180.30280.4966

0.76210.73820.35290.19880.52520.50280.54170.8998

0.45650.17630.81320.01530.20260.70950.15090.8216

0.01850.40570.00990.74680.67210.42890.69790.6449

>>A(3,3)

ans=0.41

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

当前位置:首页 > 农林牧渔 > 林学

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

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