MATLAB及其工程应用B卷10级.docx

上传人:b****1 文档编号:271125 上传时间:2023-04-28 格式:DOCX 页数:12 大小:37.47KB
下载 相关 举报
MATLAB及其工程应用B卷10级.docx_第1页
第1页 / 共12页
MATLAB及其工程应用B卷10级.docx_第2页
第2页 / 共12页
MATLAB及其工程应用B卷10级.docx_第3页
第3页 / 共12页
MATLAB及其工程应用B卷10级.docx_第4页
第4页 / 共12页
MATLAB及其工程应用B卷10级.docx_第5页
第5页 / 共12页
MATLAB及其工程应用B卷10级.docx_第6页
第6页 / 共12页
MATLAB及其工程应用B卷10级.docx_第7页
第7页 / 共12页
MATLAB及其工程应用B卷10级.docx_第8页
第8页 / 共12页
MATLAB及其工程应用B卷10级.docx_第9页
第9页 / 共12页
MATLAB及其工程应用B卷10级.docx_第10页
第10页 / 共12页
MATLAB及其工程应用B卷10级.docx_第11页
第11页 / 共12页
MATLAB及其工程应用B卷10级.docx_第12页
第12页 / 共12页
亲,该文档总共12页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

MATLAB及其工程应用B卷10级.docx

《MATLAB及其工程应用B卷10级.docx》由会员分享,可在线阅读,更多相关《MATLAB及其工程应用B卷10级.docx(12页珍藏版)》请在冰点文库上搜索。

MATLAB及其工程应用B卷10级.docx

MATLAB及其工程应用B卷10级

试题编号:

重庆邮电大学2010/2011学年2学期

MATLAB及其工程应用(普通班)试卷(期末)(B)(闭卷)

题号

总分

得分

评卷人

一、Fillintheblanks.(1scoreseach.Total30scores.)

1.1UseMATLABoperator':

'togeneratethevectorof[0,

]___

1.2Anisacollectionofdatavaluesorganizedintorowsandcolumns,andknownbyasinglename.

1.3WritetheresultsofthefollowingMATLABstatements,ifthereisanerror,pleasefill“error”.

1)a=[123;456],a(5)=_;a(8)=_;a(-2)=_

2)x=1:

0.02:

10;x=

3)u=[1:

3]';[uu]=___

4)zeros(3,2)=___;ones(3)=___;

a=[111417;121518;131619];I=eye(3);a*I=___

5)z=[-20914];z

(2)=5;z=___ 

6)u=[22-31570];u

(1)=u(4);u=___ 

7)v=[1213-39-11];v(6)=7,v=___ 

8)w=[147;258;369];w(2:

end,2:

end)=0;w=___ 

9)c=[123;456;789];c(1,[13])=-3;c=___ 

10)date=[num2str

(1)'-July-'num2str(2011)];ans=___

11)fprintf('Areaofacirclewithradius%dis%7.4f',2,pi*2^2);

ans=___

12)a=[12;34];b=[56;78];

a+b=__;a*b=__;

a.*b=__;2a=__

1.4Assumethatarray'array1'isdefinedasshown,anddeterminethecontentsofthefollowingsub-arrays.

array11=[4321;

4678;

9101112]

1)array11(3,:

)=___________

2)array11(1:

3,[2233])=__

3)array11([23],[43])=__

1.5Assumethata,b,c,anddareasdefined,andevaluarethefollowingexpressions:

a=[0,5;3,-2];b=[-1,2;0,3];c=2;d=[3,-5,7;1,0,2]

1)~(a>b)

ans=_____

2)a>c&b>c

ans=________

3)a<=c

ans=_____

1.6Assumethata,b,c,anddareasdefined,andevaluarethefollowingexpressions:

a=1;b=4;c=5;d=3

1)a*b^2>a*c

ans=_______

2)d|b>a

ans=____

3)(d|b)>a

ans=_____

二、Chosethebestanswerforthefollowingquestions.2scoreseach.Total20scores.)

2.1AmongthefollowingMATLABvariablenames,theillegaloneis

A.Faint

B.don't_bother_me

C.Help_me

D.godSaveMe

2.2A=[123;965;347],thenA(1,:

)is_____

A.[123]

B.[1]

C.[1;7]

D.[123;965;347]

2.3AmongthefollowingcommentsaboutMATLAB,thecorrectoneis_____________

A.MATLABcannotplot3-Dpictures

B.MATLAB'svariablesneedtobedefinedbeforetheyareused

C.AMATLABfunctioncanreturnmorethan1variable

D.AMATLABarraycannothave'string'inside

2.4Aboutthesimultaneousequations(线性方程组)'Ax=b',

thefollowingMATLABstatementwhichcansolvethevalueof‘x'is_____________

A.x=A/b

B.x=A./b

C.x=A\b

D.x=A.\b

2.5Assumex=1:

-2:

-8,thenx([15])is_____

  A.1,-8

B.-1,-7

C.-1,-8

D.1,-7

2.6AmongthefollowingMATLABexpressions,_____hasthedifferentresult.

A.3>4

B.pi==3.1415

C.floor(pi)-3

D.zeros(1,2)

2.7TheexecuteresultofMATLABexpression'a=7+5*3/4-sin(pi/2)'is_____

A.a=12

B.a=8

C.a=9.75

D.a=10.75

2.8AfterexecutethefollowingMATLABexpressions,theresultof's'is___

s=0;

fork=1:

10

ifk>5

continue;

end

s=s+k;

end

A.s=10

B.s=15

C.s=55

D.s=6

2.9Amongthefollowingmatlabexpressions,_____hasnoerrors.

A.a=3;a(3)=3;

B.a=[zeros(1,2)ones(2,1)]

C.a=[12];b=[345];c=a*b;

D.t=1:

10;y=t*t+1;

2.10AfterexecutethefollowingMATLABexpressions,theresultof'y'is_____

y=[];

fort=-1:

2

y=[yt^2];

end

A.[]

B.error

C.[1014]

D.[123]

三、ReadthefollowingMATLABstatementsandwritetheexecuteresults.(4scoreseach.Total20scores.)

3.1

formatshort;

s1=0;

whiles1<=10

s1=s1+1/3;

end

s1

Question:

AfterexecutetheaboveMATLABstatements,themessagedisplayinginthecommandwindowis__________________

3.2

game='StarCraft';

switchgame

case'CountStrike'

disp('Goodgame');

case'StarCraft'

disp('Myfavorite');

case'WarCraft'

disp('Notimetoplay');

default

disp('Dreamtoplayitwell');

end

Question:

AfterexecutetheaboveMATLABstatements,themessagedisplayinginthecommandwindowis___________________________________

3.3

x=[1321];

y=[4474];

plot(x,y)

Question:

AfterexecutetheaboveMATLABstatements,thefigureis

______

 

3.4

s1=-10;

whiles1

s1=s1+2;

end

Question:

AfterexecutetheaboveMATLABstatements,thevalueof‘s1’is__________________

3.5

formatshort;

disp(['Thevlaueofthepiis'num2str(pi)']);

Question:

AfterexecutetheaboveMATLABstatements,thestringdisplayedinthecommandwindowis__________________

四、(6scores)

WritetheMATLABstatementsrequiredtocalculatey(x)fromtheequation.

forvalueofxbetween-5and5instepsof0.1.

 

五、(6scores)

WriteaMATLABprogramtoplotthefunctiony1=sin(2x)+3andy2=X2+3X-7for

instepsof

onthesameaxes,Theplotincludesatitle,axislabels,alegendandgridlines.

 

六、(6scores)

Solvethefollowingsystemofsimultaneousequationsforx,andfindtheeigenvaluesanddeterminantofcoefficientmatrix

 

七、(6scores)

Writeafunctiontocalculatethehyperboliccosinefunction:

useyourfunctiontoplottheshapeofthecosinefunction.

 

八、(6scores)

Writeafunctiontocalculatethevalueof‘s’foragiven‘n’.

s=1!

+2!

+3!

+…n!

Pleasebesuretohandlethespecialcaseof0!

andreportanerrorifNisnegativeornotaninteger.

 

重庆邮电大学2010/2011学年2学期

MATLAB及其工程应用(普通班)试卷(期末)(B)(闭卷)

参考答案及评分标准

一、1.10:

pi/50:

pi

1.2array

1.3

(1)3errorerror

(2)[11.021.04……10](3)[11;22;33](4)[00;00;00][111;111;111][111417;121518;131619](5)[-25914](6)[7-31570](7)[1213-39-117](8)[147;200;300](9)[-32-3;456;789](10)1-July-2011(11)Areaofacirclewithradius2is12.5664(12)[68;1012][19224350][5122132]error

1.4

(1)[9101112]

(2)[3322;6677;10101111](3)[87;1211]

1.5

(1)[00;01]

(2)[00;00](3)[10;01]

1.6

(1)1

(2)1(3)0

二、

DACCDDCBAC

三、3.110.3333

3.2Myfavorite

3.3

3.40

3.5Thevlaueofthepiis3.1416

四、

T=-5:

0.1:

5%能正确产生t的值,给1分

N=length(t);Y=zeros(1,N);

fork=1:

N%能正确运用for语句,给2分

t=T(k);

ift>=0%能正确运用if语句,给2分

Y(k)=-7*t.*t-sqrt(t)+exp(3);%能正确写出表达式给1分

else

Y(k)=7*t.*t+sqrt(t)+exp(3);

end

end

五、

x=0:

pi/20:

pi*2;%正确产生x的值以及正确产生y1、y2给1分

y2=x.^2+3*x-7;

y1=sin(2*x)+3;

plot(x,y1,':

',x,y2,'-');%1分

title('y1(x)andy2(x)')%1分

xlabel('x');ylabel('y1andy2');%1分

legend('y1','y2');%1分

gridon;%1分

六、

由于题目维数不一致,所以去掉最后一行。

试卷中只要思想和代码的写法正确即算正确

clc

a=[-0.25.01.03.04.0

2.0-1.0-0.5-2.06.0

-1.06.0-4.0-5.0-2.0

4.03.0-6.0-5.0-2.0

-3.06.04.02.0-6.0]

b=[0.0;1.0;-6.0;10.0;-6.0]%正确写出矩阵3分

x=a\b%正确得出结果3分

七、

functionplottangent

x=-5:

0.1:

5;

y=coshf(x);%正确调用给2分

plot(x,y);

functiony=coshf(x)%正确写出函数3分

y=(exp(x)+exp(-x))/2;%正确完成功能给1分

八、

functionfact

n=input('n=')%

if(n<0)

disp('pleaseinputpositve')%完成正负判断1分

end

if(n==0)

fprintf('0!

=1')%完成0!

1分

end

if(n>0)

y=myfun(n);%调用函数及显示2分

fprintf('%d!

累加和=%d',n,y)

end

functions=myfun(n)%被调函数2分

s=0;

fork=1:

n

s=s+factorial(k);

end

 

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

当前位置:首页 > 自然科学 > 物理

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

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