1 Introduction
第一章测验
1、clear will delete anything listed in command window .
2、Workspace is the memory where all executed variables are saved.
3、>> is the command prompt in command window.
3 Matrix and its operation
3.2 Matrix merging随堂测验
1、Which function in the following can be used to generate a unit matrix of the specified number of rows and columns?
A、one
B、ones
C、eye
D、eyes
2、zero(2) ans= 0 0 0 0
3、Using the function 'rand' can generate a uniformly distributed random matrices.
4、A =[0,1;4,2] A = 0 4 1 2
5、If A =[0,1;4,2], B=A+1, then B=?
3.3 Matrix operation随堂测验
1、
,
,
,
Is the following operation legal? result = a*c
2、
,
,
,
Is the following operation legal? result = a * b
3、
,
,
,
Is the following operation legal? result = a^2
4、
,
,
,
Is the following operation legal? result = a+d
5、For squre matrix A and B, the result of ‘A/B’ is the same to that of ‘inv(A)*B’.
3.5 Operation function随堂测验
1、
,
,
,
Is the following operation legal? result=a. * b
2、
,
,
,
Is the following operation legal? result=a. / b
3、
,
,
,
Is the following operation legal? result=a. * c
4、
,
,
,
Is the following operation legal? result=a. ^2
5、A = 12 1 3 10 5 2 15 7 4 2 5 14 6 7 9 31 min(A)=?
第三章测试
1、zeros(3,3) will generate a 3 by 3 matrix, in which all elements are 0.
2、MATLAB can combine small matrices directly into large matrices.
3、In Matlab,
can be expressed by a\b.
4、Assume A is a square matrix, A*A get same value as A.^2
5、If A is a matrix, max(A) return the maximum of the corresponding columns.
6、Dot operation A.*B requires that the matrices A and B have the same size.
2 MATLAB Basics
第二章测试
1、In Matlab, 3y can be a variable name.
2、In matlab, default format is short, with 4 bits accuracy.
3、A(:,1:4) gets the first and the fourth columns from A.
4、A(:,2) gets the second columns from A.
5、The abs or double function can be used to obtain the value of the ACSII code corresponding to the string.
6、You can not call built-in functions with array inputs.
7、If a command is followed by a semicolon (;), the computational result is not shown in the command window.
8、MATLAB is case sensitive.
9、MATLAB language requires prior statement for the use of variables.
4 Calculation
4.2 Hierarchy of operations随堂测验
1、Which of the following symbols represents ‘and’ operation?
A、&
B、|
C、~
D、xor
2、If a=[1 4;5 6], c=a<5. Then c=?
A、0 1 1 0
B、0 0 1 1
C、1 1 0 0
D、1 0 1 0
3、In MATLAB false is represented by 0.
4、In matlab, the answer of 3<=4 is logical 1.
5、Arithmetic operations have lower priority than relational operations.
4.3 Polynomials随堂测验
1、If P=[1 -1], then polyval(P,2)=?
A、2
B、1
C、0
D、-1
2、Which of the following commands can be used to realize polynomial multiplication?
A、convo
B、conv
C、convolution
D、deconv
3、The addition and subtraction of vectors must be in the same length.
4、In matlab,
is represented by the vector p = [1 2 3].
4.4 Symbolic Computation随堂测验
1、Which of the following functions can be used to calculate
A、diff
B、integral
C、int
D、limit
2、The function eval can convert symbolic expressions to numeric values.
3、Command ‘syms x’ can establish a symbolic object called x
4、Command ‘sym x’ can establish a symbolic object called x.
第四章测试
1、In MATLAB, equivalence (==) is the same to assignment (=).
2、~ is the unequal operation for Matlab.
3、In Matlab,
can be expressed by a+b./c+d.
4、In Matlab,
can be expressed by [2 1].
5、deconv(f, a) can calculate the differential value of f for variable a.
6、The syms function is used to create multiple symbolic objects.
7、Hierarchy of parenthesis is higher than exponentials.
5 Potting
5.1 Two-dimensional Plotting随堂测验
1、Use plot(x,y) command, x,y must in same length.
2、If x=[1:2:6], y= [2 3 4], then x.*y=?
3、If x=0:5, y=2*x,then y=?
4、If x = linspace(1,5,5), then x=?
5.1 Two-dimensional Plotting随堂测验
1、If you want to get the axis like following figure, how to set the axis?
A、axis( [ 0 10 15 -10 ] );
B、axis( [ -10 15 0 10 ] );
C、axis( [ 0 10 -10 15 ] );
D、axis( [ 0 -10 10 15 ] );
2、Which command can plot the following figure?
A、plot(x,y,'r');
B、plot(x,y,'ro-');
C、plot(x,y,'yo-');
D、plot(x,y,'b--');
3、Which command can plot the following kind of figure?
A、stairs(y,s);
B、pie(grades);
C、bar(y,s);
D、stem(y,s);
4、subplot(2,2,2) select the which axes for the current plot?
A、A
B、B
C、C
D、D
第五章测试
1、subplot(m,n,p) divide the current figure into an m-by-n grid.
2、mesh and surf both can be used to drawing a 3-D figure.
6 Language programming
6.2 Program Design basics随堂测验
1、num2str() can convert string to number.
2、>>fprintf('x=%4.0f\n', pi) The result is x= 3.1416
6.3 Branch Statement随堂测验
1、x=5; if x<=-10 y=x+1; elseif -10
2、clear; a=1; B=3; try a=b; catch a=5; end The final value of a is 3.
3、a=1; try a=2/0; catch a=5; end The final value of a is 5.
6.4 Loop Statement随堂测验
1、s=0; i=0; while i=5 s=s+i; end The final value of s is 0.
2、i=0; s=0; while i<=5 s=s+i; end The final value of s is 15.
3、s=0; for i=1:5, if i==3 continue; end s=s+i; end The final value of s is 12.
4、s=0; for i=1:5, if i==3 break; end s=s+i; end The final value of s is 12.
5、s=0; for i=1:100 s=s+i; end The final value of s is 5050.
6、s=0; for i=1:2:3 for j=1:2 s=s+i+j; end end The final value of s is 14.
第六章测试
1、disp function can change the format of output data.
2、If it is possible to implement a calculation either with a loop or using vectors, always use vectors.
7 User-defined functions
7.2 Design and call Function随堂测验
1、Running a script is the same as running the statements in the command window
2、The only variables in the calling program that can be seen by the function are those in the input list
3、Both scripts and funtions use the global workspace.
4、The lookfor command displays the comment lines from the H1 line until the first noncomment line
5、The function statement marks the beginning of a function
7.5 Subfunction随堂测验
1、The result of fzero('sin',[0 0.5*pi]) is
A、0
B、1.57
C、3.14
D、pi
2、The result of eval('sin(pi/2)’) is
A、0
B、1
C、pi
D、0.5pi
3、error(‘msg’): display error message and abort the function
第七章测试
1、Functions share same workspace with command window.
2、A script is a collection of MATLAB statements.
9 Simulink
9.4 Subsystem Design随堂测验
1、mdl is one of filename extension for Simulink.
2、If there is a variable “ f1 ” in workspace, then “ f1 ” can be applied in Simulink directly.
3、If you are not familiar with solver in Simulink, you’d better select solver type as ‘variable step’ and solver as ‘auto’.
4、Scope can be applied to observe the figure of data in simulink.
5、For configuration parameters of a block in Simulink, generally, we can modify the parameters in the window which is given out by double clicking this block.
第九章测试
1、Add block can be used as subtract.
2、Simulink cannot use data in workspace.
8 Input/Output Functions
第八章测试
1、Permission ‘w’ can open file, or create a new file, for writing; discard existing contents, if any.
2、textread can not support different types of data in different columns.
10 Examples and experiment
第十章测试
1、Y = fix(X) rounds each element of X to the nearest integer toward positive infinity.
2、A user-defined function can be directly running by the run button in M-file Editor.