matlab第2章作业.docx

上传人:b****2 文档编号:297509 上传时间:2023-04-28 格式:DOCX 页数:16 大小:210.96KB
下载 相关 举报
matlab第2章作业.docx_第1页
第1页 / 共16页
matlab第2章作业.docx_第2页
第2页 / 共16页
matlab第2章作业.docx_第3页
第3页 / 共16页
matlab第2章作业.docx_第4页
第4页 / 共16页
matlab第2章作业.docx_第5页
第5页 / 共16页
matlab第2章作业.docx_第6页
第6页 / 共16页
matlab第2章作业.docx_第7页
第7页 / 共16页
matlab第2章作业.docx_第8页
第8页 / 共16页
matlab第2章作业.docx_第9页
第9页 / 共16页
matlab第2章作业.docx_第10页
第10页 / 共16页
matlab第2章作业.docx_第11页
第11页 / 共16页
matlab第2章作业.docx_第12页
第12页 / 共16页
matlab第2章作业.docx_第13页
第13页 / 共16页
matlab第2章作业.docx_第14页
第14页 / 共16页
matlab第2章作业.docx_第15页
第15页 / 共16页
matlab第2章作业.docx_第16页
第16页 / 共16页
亲,该文档总共16页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

matlab第2章作业.docx

《matlab第2章作业.docx》由会员分享,可在线阅读,更多相关《matlab第2章作业.docx(16页珍藏版)》请在冰点文库上搜索。

matlab第2章作业.docx

matlab第2章作业

电信系电气本0902班学号:

09401240217姓名:

孙振东

第2章MATLAB基本使用方法及常用功能介绍

2.1

>>(9*(10-1)+19)/2^2

ans=25

2.3

>>A=[1,1,1;1,2,3;1,3,6];

>>A(2,:

ans=123

2.5

>>A=eye(4)

A=1000

0100

0010

0001

2.7

>>v=[12345];

>>diag(v)

ans=10000

02000

00300

00040

00005

>>diag(v,-1)

ans=000000

100000

020000

003000

000400

000050

>>diag(v,1)

ans=010000

002000

000300

000040

000005

000000

2.9

>>2*pi

ans=6.2832

2.11

>>A=[1,2,3;4,5,6;7,8,9];

>>B=[1,2,3;4,5,6;7,8,9];

>>C=A*B

C=303642

668196

102126150

2.13

>>a=2:

8

a=2345678

2.15

>>A=[1,2,3;4,5,6;7,8,9];

>>B=A(1:

2,:

B=123

456

2.17

>>x1=5*cos(0.1*pi)/(1+sqrt

(2))

x1=1.9697

>>x2=5*sin(0.1*pi)/(1+sqrt

(2))

x2=0.6400

2.19

>>x1=[12345]

x1=12345

>>x2=[1,2,3,4,5]

x2=12345

>>x3=[1;2;3;4;5]'

x3=12345

2.21

>>A=[102030];

>>B=[405060];

>>C=dot(A,B)

C=3200

>>C=cross(A,B)

C=-300600-300

2.23

>>A=[1,3,5;2,4,6;3,5,7];

>>B=[2,4,6;1,3,5;3,5,7];

>>C=A.*B

C=21230

21230

92549

2.25

>>A=[1,3,5;2,4,6;3,5,7];

>>C=A.^2

C=1925

41636

92549

2.27

>>A=ones(3,4);

>>C={A,[1,2];'cell',[1;2]}

C=[3x4double][1x2double]

'cell'[2x1double]

2.29

>>z=5+5i;

>>Am=abs(z)

Am=7.0711

>>Fm=angle(z)

Fm=0.7854

2.31

>>A=[120;2,5-1;410-1];

>>B=inv(A)

B=52-2

-2-11

0-21

2.33

>>A=[120;25-1;410-1];

>>d=eig(A)

d=3.7321

0.2679

1.0000

>>[B,C]=eig(A)

B=-0.2440-0.91070.4472

-0.33330.33330.0000

-0.9107-0.24400.8944

C=3.732100

00.26790

001.0000

2.35

>>P=[250414];

>>poly2sym(P)

ans=2*x^5+5*x^4+4*x^2+x+4

2.37

>>P=[12.5020.52];

>>r=roots(P)

r=-2.7709

0.5611+0.7840i

0.5611-0.7840i

-0.4257+0.7716i

-0.4257-0.7716i

>>poly(r)

ans=1.00002.50000.00002.00000.50002.0000

2.39

>>p=[1234];

>>q=[102030];

>>c=conv(p,q)

c=1040100160170120

>>[s,r]=deconv(c,p)

s=102030

r=000000

2.41

>>x=0:

0.1:

1;

>>y=[-.4471.9783.286.167.087.347.669.569.489.3011.2];

>>p=polyfit(x,y,2)

p=-9.810820.1293-0.0317

2.43

>>y=sym('2*sin(x)*cos(x)')

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

>>y=simple(y)

y=sin(2*x)

2.45

>>symsx

>>f1=x^3+x^2+4*x+4;

>>f2=x^2+4*x+10;

>>f=f1+f2

f=x^3+2*x^2+8*x+14

>>y=sqrt(x^5)

y=(x^5)^(1/2)

>>z=log10(x)

z=log(x)/log(10)

2.47

>>symsabcdetnxyz;

>>y=a*x^n+b*t+c;

>>y1=subs(y,[abc],[sin(t)log(z)d*exp(2*t)])

y1=x^n*sin(t)+t*log(z)+d*exp(2*t)

>>y2=subs(y,[nc],[3pi])

y2=a*x^3+pi+b*t

>>y3=subs(y,c,1:

2:

5)

y3=[a*x^n+b*t+1,a*x^n+b*t+3,a*x^n+b*t+5]

>>y4=subs(y,c,[12;34])

y4=[a*x^n+b*t+1,a*x^n+b*t+2]

[a*x^n+b*t+3,a*x^n+b*t+4]

2.49

>>symsx;

>>y=x^4-5*x^3+5*x^2+5*x-6;

>>y1=factor(y)

y1=(x-1)*(x-2)*(x-3)*(x+1)

2.51

>>symsx;

>>y=2*cos(x)^2-sin(x)^2;

>>y1=simplify(y)

y1=3*cos(x)^2–1

2.53

>>f=sym

(1);

>>F=laplace(f)

F=1/s

2.55

>>symst;

>>f=2+sin(3*t)+exp(-2*t);

>>F=laplace(f)

F=1/(s+2)+3/(s^2+9)+2/s

>>[n,d]=numden(F)

n=3*s^3+7*s^2+33*s+36

d=s^4+2*s^3+9*s^2+18*s

2.57

>>symsts;

>>fs11=2/(s+1)-1/(s+2);

>>fs12=1/(s+1)-1/(s+2);

>>fs21=-2/(s+1)+2/(s+2);

>>fs22=-1/(s+1)+2/(s+2);

>>Fs=[fs11,fs12;fs21,fs22];

>>Mt=ilaplace(Fs)

Mt=[2/exp(t)-1/exp(2*t),1/exp(t)-1/exp(2*t)]

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

2.59

>>symsTnza;

>>F1=ztrans(n*T)

F1=(T*z)/(z-1)^2

>>F2=ztrans((n*T)^2)

F2=(T^2*(z^2+z))/(z-1)^3

>>F31=ztrans(exp(a*n*T))

F31=z/(z-exp(T*a))

>>F32=simple(ztrans(exp(a*n*T)))

F32=z/(z-exp(T*a))

2.61

>>x=0:

0.1*pi:

pi;

y=sin(x).*cos(x);

plot(x,y)

2.63

>>x=(0:

pi/50:

2*pi)';

>>k=0.4:

0.1:

1;

>>Y=cos(x)*k;

>>plot(Y)

2.65

>>x=0:

0.5:

4*pi;

>>y1=exp(-0.1*x).*sin(x);

>>y2=exp(-0.1*x).*sin(x+1);

>>plot(x,y1,'+g');

>>holdon

>>plot(x,y2,':

r');

>>holdoff

2.67

>>x=pi*(0:

1000)/1000;

>>y1=sin(x);

>>y2=sin(10*x);

>>y12=sin(x).*sin(10*x);

>>subplot(2,2,1),plot(x,y1),axis([0,pi,-1,1])

>>subplot(2,2,2),plot(x,y2),axis([0,pi,-1,1])

>>subplot('position',[0.2,0.05,0.6,0.45])

>>plot(x,y12),axis([0,pi,-1,1])

2.69

>>x=0:

0.5:

4*pi;

>>y1=exp(-0.1*x).*sin(x);

>>y2=exp(-0.1*x).*sin(x+1);

>>plot(x,y1,x,y2,':

')

>>legend('第一条','第二条')

2.71

>>theta=0:

0.1:

2*pi;

>>polar(theta,sin(2*theta).*cos(2*theta),'--r')

2.73

>>t=0:

pi/50:

10*pi;

>>plot3(sin(t),cos(t),t)

>>gridon

2.75

>>[X,Y]=meshgrid(-8:

0.5:

8);

>>R=sqrt(X.^2+Y.^2)+eps;

>>Z=sin(R)./R;

>>mesh(X,Y,Z)

2.77

>>figure

2.79

2.81

>>sum=0;

>>fork=1:

100

sum=sum+k;end

>>sum

sum=5050

2.83

>>sum=0;

>>k=1;

>>whilek<=100

sum=sum+k;

k=k+1;

end

>>sum

sum=5050

2.85

a=[123;456;789];

m=2;n=3;

ifm==n

a(m,n)=0;

elseifabs(m-n)==2

a((m-1),(n-1))=-1;

else

a(m,n)=-5;

end

a

a=

123

45-5

789

2.87

A=magic(3)

B=ones(4,3)

try

C=A*B;

catch

C=NaN

end

lasterr

>>e2_87

A=816

357

492

B=111

111

111

111

C=NaN

ans=

Errorusing==>mtimes

Innermatrixdimensionsmustagree.

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

当前位置:首页 > 法律文书 > 调解书

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

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