Matlab考试题库+答案 联系客服

发布时间 : 星期二 文章Matlab考试题库+答案更新完毕开始阅读7eb591d9ac51f01dc281e53a580216fc700a5382

D. x1=1 x2=-1

19. 清除工作空间(wordspace)的命令是( B) A. clc;

B. clear;

C. clf;

D.delete;

20. 运行如下程序后,输入9回车,命令窗口(command windows)显示的结果为( D ) x=input('请输入x的值:'); if x==10

y=cos(x+1)+sqrt(x*x+1); else

y=(3^(1/2))*sqrt(x+sqrt(x)); end y A. 9

B. 8

C. 7

D. 6

21. 运行如下程序后, 命令窗口(command windows)显示的结果为( B) s=0;

a=[12,13,14;15,16,17;18,19,20]; for k=a s=s+k; end disp(s'); A. 144

B. 39 48 57 C.145 D. 45 48 51

22. 运行如下程序后, 命令窗口(command windows)显示的结果为(B ) k=0; for n=100:200

if rem(n,21)~=0 %R=rem(X,Y),求余数函数,X,Y应该为正数 k=k+1;

continue end break; end k

A.105 B. 5 C.4 D.101

23. 图形窗口(Figure)显示网格的命令是(B) A. axis on

B. grid on

C. box on

D. hold on

24. 已知函数文件如下,则factor(4)=(C ) function f=factor(n) if n<=1 f=1; else

f=factor(n-1)*n; end A. 4

B. 12

C. 24

D.48

25. 运行如下程序后, 命令窗口(command windows)显示的结果为D A=[13,-56,78; 25,63,-735; 78,25,563; 1,0,-1]; y=max(maxA) A. y=564

B.y=9

C.y=-735 D.y=563

26. 在图形指定位置加标注命令是(C) A. title(x,y,?y=sin(x)?); C. text(x,y,?y=sin(x)?);

B. xlabel(x,y,?y=sin(x)?);

D. legend(x,y,?y=sin(x)?); %添加图例的标注,

27.下列哪个函数为插值函数(B ) A. P=polyfit(X,Y,3)

B. Y1=interp1(X,Y,X1,'method')

C. [Y,I]=sort(A,dim) D. R=corrcoef(X)

28.i=2; a=2i; b=2*i; c=2*sqrt(-1); 程序执行后;a, b, c的值分别是多少?( C ) A a=4, b=4, c=2.0000i B a=4, b=2.0000i, c=2.0000i C a=2.0000i, b=4, c=2.0000i D a=2.0000i, b=2.0000i, c=2.0000i

29. 求解方程x4-4x3+12x-9 = 0 的所有解( A ) A 1.0000, 3.0000, 1.7321, -1.7321 B 1.0000, 3.0000, 1.7321i, -1.7321i C 1.0000i, 3.0000i, 1.7321, -1.7321 D -3.0000i, 3.0000i, 1.7321, -1.7321

30、在循环结构中跳出循环,但继续下次循环的命令为 。( C ) A return; B break ; C continue ; D keyboard

31. 用round函数四舍五入对数组[2.48 6.39 3.93 8.52]取整,结果为( C ) A [2 6 3 8] B [2 6 4 8] C [2 6 4 9] D [3 7 4 9] 32. 已知a=2:2:8, b=2:5,下面的运算表达式中,出错的为 ( C ) A a' *b B a .*b 辨析题:

1、MATLAB有几种建立矩阵的方法?各有什么优点?。

2、MATLAB提供编程语言,请辨析M文件编程中的命令文件与函数文件两种形式。 3、辨析matlab中的拟合与插值有什么区别 4、判断下列一段程序的错误,并进行改正。

x=-2:0.2:2;

y=x.^2; plot(x,y)

str1 = num2str(min(x));

C a*b D a-b

% 数字转化为字符串

str2 = num2str(max(x)); out = [Value of f from 'str1' to 'str2']; xlabel(out);

% 数字转化为字符串

out = ['Value of f from ' str1 ' to ' str2];

或out = ['Value of f from str1 to str2'];

问答题:

1、MATLAB系统包括哪些窗口,各个窗口功能是什么? 2、 mysum=0;i=1; While (i<=100)

mysum=mysum+i; i=i+1; end mysum

mysum =5050

3、编写一个函数,使其能够产生如下的分段函数:并调用此函数,绘制x=[0,+2]范围内的f(x)*f(x+2) 。 function y=f(x) if x<=2

y=0.5*x; else if y=0.5;

x>6

f(x)=1 x = 0:0.05:2;

y = diag(A2(x)'*A2(x+2)); plot (x,y); xlabel ('\\bfx'); ylabel ('\\bfy');

else y =1.5-0.25*x; end end

运行结果 x=2