机电系统仿真Word下载.docx

上传人:b****3 文档编号:8071156 上传时间:2023-05-10 格式:DOCX 页数:20 大小:108.30KB
下载 相关 举报
机电系统仿真Word下载.docx_第1页
第1页 / 共20页
机电系统仿真Word下载.docx_第2页
第2页 / 共20页
机电系统仿真Word下载.docx_第3页
第3页 / 共20页
机电系统仿真Word下载.docx_第4页
第4页 / 共20页
机电系统仿真Word下载.docx_第5页
第5页 / 共20页
机电系统仿真Word下载.docx_第6页
第6页 / 共20页
机电系统仿真Word下载.docx_第7页
第7页 / 共20页
机电系统仿真Word下载.docx_第8页
第8页 / 共20页
机电系统仿真Word下载.docx_第9页
第9页 / 共20页
机电系统仿真Word下载.docx_第10页
第10页 / 共20页
机电系统仿真Word下载.docx_第11页
第11页 / 共20页
机电系统仿真Word下载.docx_第12页
第12页 / 共20页
机电系统仿真Word下载.docx_第13页
第13页 / 共20页
机电系统仿真Word下载.docx_第14页
第14页 / 共20页
机电系统仿真Word下载.docx_第15页
第15页 / 共20页
机电系统仿真Word下载.docx_第16页
第16页 / 共20页
机电系统仿真Word下载.docx_第17页
第17页 / 共20页
机电系统仿真Word下载.docx_第18页
第18页 / 共20页
机电系统仿真Word下载.docx_第19页
第19页 / 共20页
机电系统仿真Word下载.docx_第20页
第20页 / 共20页
亲,该文档总共20页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

机电系统仿真Word下载.docx

《机电系统仿真Word下载.docx》由会员分享,可在线阅读,更多相关《机电系统仿真Word下载.docx(20页珍藏版)》请在冰点文库上搜索。

机电系统仿真Word下载.docx

c=

40000

04000

00400

00040

00004

(二)数组元素的寻访:

1、一维数组的寻访:

x=[2.00001.04721.73213.0000+5.0000i];

x1=x(3)

x2=x([124])

x3=x(2:

end)

x4=x(4:

-1:

1)

1.7321

2.00001.04723.0000+5.0000i

1.04721.73213.0000+5.0000i

x4=

3.0000+5.0000i1.73211.04722.0000

2、二维数组的寻访:

A=rand(5,5)

A1=A(2,:

A2=A(1:

3,3:

5)

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

A=

0.81470.09750.15760.14190.6557

0.90580.27850.97060.42180.0357

0.12700.54690.95720.91570.8491

0.91340.95750.48540.79220.9340

0.63240.96490.80030.95950.6787

A1=

A2=

0.15760.14190.6557

0.97060.42180.0357

0.95720.91570.8491

A3=

0.15760.6557

0.97060.0357

二、掌握数组运算和矩阵运算的区别:

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

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

三、掌握关系运算和逻辑运算:

1、关系运算:

X=2:

8,Y=10-X,r0=(X<

4),r1=(X==Y),r2=(X>

Y)

X=

2345678

Y=

8765432

r0=

1100000

r1=

0001000

r2=

0000111

2、逻辑运算:

X=[0234;

1350];

Y=[1053;

1505];

Z=X&

Y

M=X|Y

N=~X

Z=

0011

1100

M=

1111

N=

1000

0001

四、了解字符串数组的创建、掌握字符串操作函数:

1、字符串数组的创建:

a='

student'

b='

学生'

student

b=

学生

x=rand(3,3),y='

example'

z=abs(y)

m=char(z)

n=num2str(x)

k=str2num(n)

2、字符串操作函数:

x=

0.96490.95720.1419

0.15760.48540.4218

0.97060.80030.9157

y=

example

z=

10112097109112108101

m=

n=

0.964890.957170.14189

0.157610.485380.42176

0.970590.800280.91574

k=

0.97060.80030.9157

五、掌握元胞数组和构架数组的创建和索引:

六、熟练使用plot()命令:

(一)plot基本调用格式:

1、plot(X,'

s'

t=(0:

pi/50:

2*pi)'

;

k=0.4:

0.1:

1;

X=sin(t)*k;

plot(X)

2、plot(X,Y,'

a=(0:

pi/60:

b=0.5:

0.2:

X=sin(a)*b;

plot(a,X)

(二)曲线的色彩、线型和数据点型:

1、色彩和线型:

t=(0:

pi/100:

pi)'

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

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

plot(t,y1,'

g:

'

t,y2,'

r'

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

2、数据点型:

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

t1=pi*(0:

9)/9;

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

plot(t,y2,'

b'

t1,y3,'

bp'

(三)图形控制:

1、简捷格式:

t=0:

0.01:

pi;

A=[1,3]'

w=[2,5]'

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

plot(t,y(1,:

),'

-.'

t,y(2,:

))

legend('

w=2,A=1'

'

w=5,A=3'

xlabel('

t'

),ylabel('

y'

title('

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

2、精细指令格式:

B=[1,3]'

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

\rm\omega=2,\bf\alpha=1'

\rm\omega=5,\bf\alpha=3'

\fontsize{16}\bft'

ylabel('

\fontsize{16}y'

\rmy=1-e^{-\alphat}sin\omegat'

3、双纵坐标图:

0.02:

4

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)

text(2,0.3,'

\fontsize{14}\fontname{黑体}单位脉冲响应'

text(2,1.1,['

\fontsize{16}\fontname{宋体}单位阶跃响应'

])

t=

Columns1through10

00.02000.04000.06000.08000.10000.12000.14000.16000.1800

Columns11through20

0.20000.22000.24000.26000.28000.30000.32000.34000.36000.3800

Columns21through30

0.40000.42000.44000.46000.48000.50000.52000.54000.56000.5800

Columns31through40

0.60000.62000.64000.66000.68000.70000.72000.74000.76000.7800

Columns41through50

0.80000.82000.84000.86000.88000.90000.92000.94000.96000.9800

Columns51through60

1.00001.02001.04001.06001.08001.10001.12001.14001.16001.1800

Columns61through70

1.20001.22001.24001.26001.28001.30001.32001.34001.36001.3800

Columns71through80

1.40001.42001.44001.46001.48001.50001.52001.54001.56001.5800

Columns81through90

1.60001.62001.64001.66001.68001.70001.72001.74001.76001.7800

Columns91through100

1.80001.82001.84001.86001.88001.90001.92001.94001.96001.9800

Columns101through110

2.00002.02002.04002.06002.08002.10002.12002.14002.16002.1800

Columns111through120

2.20002.22002.24002.26002.28002.30002.32002.34002.36002.3800

Columns121through130

2.40002.42002.44002.46002.48002.50002.52002.54002.56002.5800

Columns131through140

2.60002.62002.64002.66002.68002.70002.72002.74002.76002.7800

Columns141through150

2.80002.82002.84002.86002.88002.90002.92002.94002.96002.9800

Columns151through160

3.00003.02003.04003.06003.08003.10003.12003.14003.16003.1800

Columns161through170

3.20003.22003.24003.26003.28003.30003.32003.34003.36003.3800

Columns171through180

3.40003.42003.44003.46003.48003.50003.52003.54003.56003.5800

Columns181through190

3.60003.62003.64003.66003.68003.70003.72003.74003.76003.7800

Columns191through200

3.80003.82003.84003.86003.88003.90003.92003.94003.96003.9800

Column201

4.0000

4、多子图:

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:

);

5、多次叠绘:

clf;

t=2*pi*(0:

20)/20;

y=cos(t).*exp(-0.4*t);

stem(t,y,'

g'

holdon;

stairs(t,y,'

holdoff

6、给定函数的曲线绘制:

clf

ezplot('

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

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

7、交互式图形指令:

(获取图形数据)

dx=0.1;

x=0:

dx:

4;

y=x.*sin(x);

plot(x,y)

[x1,y1]=ginput(4)

1.1567

1.6175

0.9912

0.2368

七、三维绘图:

(一)使用mesh()绘图指令:

x=-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

(二)使用surf()绘图指令:

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)

八:

MATLAB程序控制:

(一)for循环结构:

t=[0:

18]'

forx=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(t,y),holdon

end

xlabel('

t(秒)'

),title('

二阶系统阶跃响应'

text(3.3,0.9,'

{\xi}=0.8'

),text(4.3,1.4,'

{\xi}=0.2'

(二)while循环结构:

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

ans=

10946

(三)switch-case循环结构:

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

z=atan(b/x);

y1=-t*x;

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

switchround(10*x)

case2

plot(t,y,'

r-'

),holdon

case4

b*'

case6

k.'

otherwise

g+'

{\xi}0.4'

{\xi}=0.6'

九:

使用关键字function来创建m函数:

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

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

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

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