The MATLAB NotebookWord文档格式.docx

上传人:b****7 文档编号:22538162 上传时间:2023-02-04 格式:DOCX 页数:24 大小:180.34KB
下载 相关 举报
The MATLAB NotebookWord文档格式.docx_第1页
第1页 / 共24页
The MATLAB NotebookWord文档格式.docx_第2页
第2页 / 共24页
The MATLAB NotebookWord文档格式.docx_第3页
第3页 / 共24页
The MATLAB NotebookWord文档格式.docx_第4页
第4页 / 共24页
The MATLAB NotebookWord文档格式.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

The MATLAB NotebookWord文档格式.docx

《The MATLAB NotebookWord文档格式.docx》由会员分享,可在线阅读,更多相关《The MATLAB NotebookWord文档格式.docx(24页珍藏版)》请在冰豆网上搜索。

The MATLAB NotebookWord文档格式.docx

x4=x(4:

-1:

1)

x=

1.0e+004*

0.00020.00010.00020.0003+2.0000i

1.7895

0.00020.00010.0003+2.0000i

0.00010.00020.0003+2.0000i

x4=

0.0003+2.0000i0.00020.00010.0002

二维数组的寻访

A=rand(3,5)

A1=A(1,:

A2=A(1:

2,2:

5)

A3=A([1,3],[2,5])

A=

0.95010.48600.45650.44470.9218

0.23110.89130.01850.61540.7382

0.60680.76210.82140.79190.1763

A1=

A2=

0.48600.45650.44470.9218

0.89130.01850.61540.7382

A3=

0.48600.9218

0.76210.1763

数组与矩阵运算比较

A=[-1,-2,-3;

-4,-5,-6;

-7,-8,-9]

B=[1,2,3;

4,5,6;

7,8,9]

C=A+B*i

CN=C.'

CM=C'

ABN=A.*B

ABM=A*B

-1-2-3

-4-5-6

-7-8-9

B=

456

789

C=

-1.0000+1.0000i-2.0000+2.0000i-3.0000+3.0000i

-4.0000+4.0000i-5.0000+5.0000i-6.0000+6.0000i

-7.0000+7.0000i-8.0000+8.0000i-9.0000+9.0000i

CN=

-1.0000+1.0000i-4.0000+4.0000i-7.0000+7.0000i

-2.0000+2.0000i-5.0000+5.0000i-8.0000+8.0000i

-3.0000+3.0000i-6.0000+6.0000i-9.0000+9.0000i

CM=

-1.0000-1.0000i-4.0000-4.0000i-7.0000-7.0000i

-2.0000-2.0000i-5.0000-5.0000i-8.0000-8.0000i

-3.0000-3.0000i-6.0000-6.0000i-9.0000-9.0000i

ABN=

-1-4-9

-16-25-36

-49-64-81

ABM=

-30-36-42

-66-81-96

-102-126-150

数组的关系运算和逻辑运算

数组的关系运算

A=1:

9,B=10-A,r0=(A<

4),r1=(A==B),r2=(A>

B)

123456789

987654321

r0=

111000000

r1=

000010000

r2=

000001111

数组的逻辑运算

A=[0,2,3,4;

1,3,5,0];

B=[1,0,5,3;

1,5,0,5]

C=A&

B

D=A|B

E=~A

1053

1505

0011

1100

D=

1111

E=

1000

0001

字符串数组创建

a='

sumsption'

b='

学院'

sumsption

b=

学院

size(a)

ans=

19

b=a(end:

noitpsmus

A='

机械电子工程'

size(A)

机械电子工程

16

B='

'

size(B)

18

B=[A,'

研究院'

]

机械电子工程研究院

串转换函数

a=rand(2,2),b='

example'

c=abs(b)

d=char(c)

e=num2str(a)

0.40570.9169

0.93550.4103

example

10112097109112108101

e=

0.405710.9169

0.935470.41027

|构架数组

student_rec.number=1;

student_rec.name='

AlanShearer'

;

student_rec.height=180;

student_rec.test=[100,80,75;

77,60,92;

67,28,90;

100,89,78];

student_rec

student_rec.test

student_rec=

number:

1

name:

'

height:

180

test:

[4x3double]

1008075

776092

672890

1008978

t=(0:

pi/50:

2*pi)'

k=0.4:

0.1:

1;

X=cos(t)*k;

plot(X)

 

plot(t,X)

pi/100:

pi)'

y1=sin(t)*[1,-1];

y2=sin(t).*sin(9*t);

plot(t,y1,'

m:

t,y2,'

g'

t1=pi*(0:

9)/9;

y3=sin(t1).*sin(9*t1);

plot(t,y2,'

b'

t1,y3,'

bp'

t=0:

0.01:

pi;

B=[1,3]'

w=[2,5]'

y=sin(w*t).*exp(-B*t);

plot(t,y(1,:

),'

-.'

t,y(2,:

))

legend('

w=2,B=1,'

'

w=5,B=3'

xlabel('

t'

),ylabel('

y'

title('

y=sin(wt)*exp(-Bt)'

0.02:

3;

xi=0.5;

wn=5;

sxi=sqrt(1-xi^2);

sita=atan(sxi/xi);

wd=wn*sxi;

y1=1-exp(-xi*wn*t).*sin(wd*t+sita)/sxi;

y2=wn*exp(-xi*wn*t).*sin(wd*t)/sxi;

plotyy(t,y1,t,y2)

t=(pi*(0:

1000)/1000)'

y1=sin(t);

y2=sin(10*t);

y12=sin(t).*sin(10*t);

subplot(2,2,1),plot(t,y1);

axis([0,pi,-1,1])

subplot(2,2,2),plot(t,y2);

subplot('

position'

[0.2,0.05,0.6,0.45])

plot(t,y12,'

b-'

t,[y1,-y1],'

r:

);

axis([0,pi,-1,1])

ezplot('

x^2+x*y+y^2-10'

axis([-4,4,-4,4])

x=-4:

4;

y=x;

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

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

subplot(1,3,1),surf(X,Y,Z);

subplot(1,3,2),mesh(X,Y,Z);

subplot(1,3,3),plot3(x,y,x.^2+y.^2);

boxon

clf

[x,y]=meshgrid(-3:

3,-2:

2);

z=(x.^2+2*x).*exp(-x.^2-y.^2-x.*y);

subplot(1,2,1),mesh(x,y,z),

axis([-3,3,-2,2,-0.5,1.0])

透视'

hiddenoff

subplot(1,2,2),mesh(x,y,z)

消隐'

hiddenon

axis([-3,3,-2,2,-0.5,1.0])

2)*pi;

x=sin(t);

y=cos(t);

z=cos(2*t);

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

x,y,z,'

bd'

view([-82,58])

视点控制'

),boxon

subplot(1,2,2),plot(x,y,z,'

boxon,title('

无视点控制'

?

Errorusingplot

Stringargumentisanunknownoption.

subplot(1,3,1),surf(peaks),alpha(0)

完全透明'

colormap(summer);

subplot(1,3,2),surf(peaks),alpha(0.5)

半透明'

colormap(summer)

subplot(1,3,3),surf(peaks),alpha

(1)

完全不透明'

colormap(summer)

z=(x.^2-1.4*x).*exp(-x.^2-y.^2+x.*y);

figure

(1)

surf(x,y,z),axis([-3,3,-2,2,-0.5,1.0])

shadingflat'

),shadingflat

figure

(2)

shadinginterp'

),shadinginterp

figure(3)

shadingfacted'

),shadingfacted

Errorusingshading(line106)

Shadingmethodsareflat,faceted,andinterp.

ezsurf('

x.^2+y.^2'

[-10,10],100)

shadingflat

clf;

t=[0:

18]'

forx=0.2:

0.2:

0.8

b=sqrt([1-x^2]);

z=atan(b/x);

y1=-t*x;

y2=t*b+z;

y=1-exp(y1).*sin(y2)/b;

plot(x,y),holdon

end

a

(1)=1;

a

(2)=1;

i=2;

whilea(i)<

=10000

a(i+1)=a(i-1)+a(i);

i=i+1;

end;

i,a(i)

i=

21

10946

switchround(10*x)

case2

plot(t,y,'

r-'

),holdon

case4

b*'

),hold

case6

k.'

otherwise

g+'

end

t(秒)'

),title('

二阶系统阶跃响应'

{\xi}=0.2'

{\xi}=0.4'

{\xi}=0.6'

{\xi}=0.8'

Currentplotreleased

Warning:

Ignoringextralegendentries.

{_>

Inlegendat291}_

clear,N=4;

A=magic(3);

try

A_N=A(N,:

catch

A_end=A(end,:

lasterr

A_end=

492

Indexexceedsmatrixdimensions.

sa=circle(10,'

circle(10,'

k'

Undefinedfunction'

circle'

forinputargumentsoftype'

double'

.

functiony1=mainfun(a,s)

a)/a*2*pi;

y1=subfun(4,s);

functiony2=subfun(a,s)

ss='

a*exp(i*t)'

switchs

case{'

base'

caller'

}

y2=evalin(s,ss);

case'

self'

y2=eval(ss);

clear

a=30;

sss={'

};

fork=1:

3

y0=mainfun(8,sss{k});

subplot(1,3,k)

plot(real(y0),imag(y0),'

r'

lineWidth'

3)

axissquare

end

mainfun'

.

t=pi;

evel('

theta=t/2,y1=sin(theta)'

evel'

char'

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

当前位置:首页 > 人文社科 > 哲学历史

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

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