**chapter 0 getting into matlab****course introduction随堂测验**

1、the word matlab comes from the abbreviations of ( ).

a、mathematica laboratory

b、matrix laboratory

c、mathworks lab

d、matrices lab

2、among the following options, one that reflects the characteristics of matlab is ( ).

a、optimal algorithm

b、there is no need to write programs

c、high efficiency in program execution

d、high programming efficiency

3、scientific computing is the third scientific research method after scientific experiment and theoretical research.

4、there is no need for any numerical computing method when using matlab to solve problems in scientific computing.**chapter 1 basic knowledge of matlab****1.1 matlab system environment随堂测验**

1、when typing a command in the command window, you can follow the first physical line with a continuation character and press enter, then continue typing the rest of the command on the next physical line. the way to write a continuation character is ( ).

a、ellipsis (...)

b、semicolon (;)

c、three decimal points (...)

d、percent sign (%)

2、in the matlab command window, the symbol that prompts the user to enter the command is ( ).

a、>

b、>>

c、>>>

d、>>>>

3、there are fpp.m files in both the current folder and the search path, so when you type fpp in the command window, the file that will be executed is ( ).

a、the fpp.m file in the search path will be executed at first, then the fpp.m file in the current folder be executed

b、the fpp.m file in the search path

c、the fpp.m file in the current folder will be executed at first, then the fpp.m file in the search path be executed

d、the fpp.m file in the current folder**1.2 matlab numerical data随堂测验**

1、in the command window input the command: >> x = int8 (130)the value of x is ( ).

a、127

b、129

c、128

d、-127

2、fix(264/100) mod(264,10)*10 equals ( ).

a、86

b、62

c、423

d、42

3、the value of sin(pi/2) is equal to that of sind(90).**1.3 variables随堂测验**

1、the following identifier that can be used as a valid variable name in matlab is ( ).

a、12my

b、_123

c、@h

d、xyz_2a

2、input the following command in the command window: >> clear >> x=i*jthe value of x is ( ).

a、uncertain

b、-1

c、1

d、i*j

3、the memory variable file is a binary format file with an extension of ".mat".**1.4 matlab matrix representation随堂测验**

1、when creating a matrix, the elements of the different rows are separated by ( ).

a、comma

b、space

c、semicolon

d、quotation mark

2、using the statement t=0:9, we generate a vector of ( ) elements.

a、8

b、9

c、6

d、10

3、using the statement x=linspace(0,pi,6), we generate a vector of ( ) elements.

a、8

b、7

c、6

d、5**1.5 matrix elements reference随堂测验**

1、after executing statement a=[1,2,3;4,5,6], the value of a(3) is ( ).

a、1

b、2

c、3

d、4

2、given that a is a 3×3 matrix, a(:,end) refers to ( ).

a、all the elements

b、the elements of the first row

c、the elements of the third row

d、the elements of the third column

3、if a is known to be a 3×5 matrix, then after executing a(:, [2,4])=[], ( ).

a、a transforms to a row vector

b、a transforms to 3 rows and 2 columns

c、a transforms to 3 rows 3 columns

d、a transforms to 2 rows 3 columns

4、if a is known to be a 2×3 matrix, then after executing a=a(:), ( ).

a、a transforms to a column vector

b、a transforms to 3 rows and 2 columns

c、a transforms to 3 rows and 3 columns

d、a transforms to 2 rows 3 and columns

5、the result of executing the function reshape(1:6,2,3) is ( ).

a、a row vector of six elements

b、a column vector of the six elements

c、a 2×3 matrix

d、a 3×2 matrix**1.6 basic operations of matlab随堂测验**

1、1、in matlab, the right division operator (/) and the left division operator (\) are equivalent.

2、if a is nonsingular square matrix, then b/a is equivalent to inv(a)*b.

3、when you take the operation of dot product between two matrices, you want them to be identical.

4、expression ~(9==1) is equal to the value of expression ~9==1.**1.7 string processing随堂测验**

1、when entering a string, enclose the sequence of characters with ( ).

a、[ ]

b、{ }

c、' '

d、" "

2、it is known that ch=['abcdef ';'123456'], then the character represented by ch(2,4) is ( ).

a、4

b、3

c、c

d、d

3、the result of the expression 'www0'>='w123' is ( ).

a、1 1 0 0

b、1 1 1 0

c、1 0 0 0

d、0 0 0 1

4、the value of eval('sqrt(4) 2') is ( ).

a、sqrt(4) 2

b、4

c、2

d、2, 2**unit test 1**

1、when executing a command in command window, if you do not want to output the result immediately in the command window, you can add ( ).

a、colon (:)

b、comma (,)

c、semicolon (;)

d、percent (%)

2、the value of the expression fix(exp(1)) mod(264,10)*10 is ( ).

a、86

b、62

c、423

d、42

3、after the following command is executed, the value of x is ( ). >> clear >> 5i; >> ans*j

a、5i

b、-5

c、5

d、5i*j

4、the statement x=linspace(1,10,6) will generate a vector of ( ) elements.

a、1

b、5

c、6

d、10

5、the result of function floor(-2.1) is ( ).

a、-3

b、-2

c、1

d、2

6、the format option that would result in the following output format is ( ). >> 2/5 3/11 ans = 37/55

a、long

b、short

c、hex

d、rat

7、if it is known that a is a 3×5 matrix, after executing a(:,1:2:3)=[], ( ).

a、a becomes row vector

b、a becomes 3 rows and 3 columns

c、a becomes 3 rows and 2 columns

d、a becomes 2 rows and 3 columns

8、input the following command in command window: >> a=[1:3;4:6]; >> d=sub2ind(size(a),[1,1],[2,3])the value of d is（ ）。

a、3 6

b、2 5

c、4 5

d、3 5

9、if the fpp.m file exists in both the current folder and search path, the wrong options in the following statement are ( ) when entering fpp in the command window.

a、execute the fpp.m file in the search path at first, then execute the fpp.m file in the current folder

b、only execute the fpp.m file in search path

c、executes the fpp.m file of the current folder at first, then execute the fpp.m file in the search path

d、only execute fpp.m file in current folder

10、the matlab expression for the following mathematical expression are ( ). (here π and e are all mathematical constants.)

a、pi-exp(pi)

b、pi-power(exp(1),pi)

c、pi-e^pi

d、pi-exp(1)^pi

11、when x = 0.1, 0.3, 0.5, 0.7, 0.9, use the following expression to find the value of y = sinx cosx respectively. >> x=0.1:0.2:0.9; >> y=sin(x)*cos(x);

12、the format command not only affects the data output format, but also affects the calculation and storage of data.

13、in a matrix a with 3 rows and 3 columns, a(4) represents the element in the second row and the first column of matrix a.

14、the value of expression ~(5|3) is not equal to the value of expression ~5|3.**chapter 2 matlab matrix manipulation****2.1 special matrices随堂测验**

1、the command which can create the third order identity matrix a is ( ).

a、a=eye(3)

b、a=eye(3,1)

c、a=eye(1,3)

d、a=ones(3)

2、the command to create a matrix of ones of the same size as a is ( ).

a、one(size(a))

b、ones(size(a))

c、ones(a)

d、size(ones(a))

3、the statement that can create a 5×6 random matrix of which element is a random integer in the range of [100,200] is ( ).

a、a= fix(100 200*rand(5,6))

b、a= fix(200 100*rand(5,6))

c、a= fix(100 300*rand(5,6))

d、a=fix(100 101*rand(5,6))

4、the statement that can create 500 normally distributed random numbers with a mean value of 1 and a variance of 0.2 is（ ）。

a、x=0.2 randn(500)

b、x=1 0.2*randn(500)

c、x=1 sqrt(0.2)*randn(25,20)

d、x=0.2 randn(25,20)

5、hilbert matrix is an ill-conditioned matrix. its ill conditioned degree is related to the order of the matrix. with the decrease of order, the ill conditioned degree is more serious.**2.2 matrix transformations随堂测验**

1、the command which can use the elements of the second diagonal below the main diagonal of matrix a to create a diagonal matrix b is ( )。

a、b=diag(a,-2)

b、b=diag(diag(a,-2))

c、b=diag(triu(a,-2))

d、b=diag(tril(a,-2))

2、in the following pairs of commands, the pair with different results is ( ).

a、x=(-2:2)' and x=[-2:2]’

b、x=diag(diag(ones(3))) and x=eye(3)

c、x=rot90(a) and x=fliplr(a)

d、x=triu(a,1) tril(a,-1) and x=a-diag(diag(a))

3、the command to add 30 to the diagonal elements of matrix a is ( ).

a、a 30*eye(size(a))

b、a 30*eye(a)

c、a 30*ones(size(a))

d、a 30*eye(4)

4、set a as a 6-order square matrix, and generate 2×3 matrix b from the elements of its sub-diagonal (it is required that the column number of the sub-diagonal element is not changed). the corresponding command is ( ).

a、b=reshape(diag(fliplr(a)),3,2)

b、b=reshape(diag(fliplr(a)),2,3)

c、b=reshape(diag(flipud(a)),3,2)

d、b=reshape(diag(flipud(a)),2,3)

5、the function rot90(x, 4) is the same as x.**2.3 matrix evaluations随堂测验**

1、the value returned by the function trace(diag (1:5)) is ( ).

a、5

b、15

c、0

d、120

2、the value returned by the function det(diag(1:5)) is ( ).

a、5

b、15

c、0

d、120

3、the norm must be non-negative.

4、the rank of even order magic square is 3.

5、the conditional number is always greater than 1 and close to 1.**2.4 matrix eigenvalues and eigenvectors随堂测验**

1、after excuting the statement "[x,d]=eig(a)", d is（ ）.

a、a scalar matrix

b、an identity matrix

c、a triangular matrix

d、a diagonal matrix

2、the function in matlab which can demonstrate the relationship between vector x and ax is ( ).

a、eigshow

b、showeig

c、eigdisp

d、dispeig

3、it is known that a is a square matrix. after executing the statement [x, d] = eig (a), theoretically, the correct options are ( ).

a、a•x equals x•d

b、a•x(:, 1) equals d(1, 1)•x(:, 1)

c、a•x(:, end) equals d(end, end)•x(:, end)

d、a•x(1:end, 1) equals d(1)•x(:, 1)

4、taking the unit vector x continuously, ax can stretch the circle into an ellipse.**2.5 sparse matrices随堂测验**

1、the main purpose of using sparse storage is to ( ).

a、change storage order

b、improve operation precision

c、save memory space

d、design efficient algorithm

2、after executing the statement a=sparse([0,1,1;0,0,1]), the last line of the output result is（ ）.

a、(1,2) 1

b、(1,3) 1

c、(1,3) 0

d、(2,3) 1

3、the matrix which adopts sparse storage method must be a sparse matrix.

4、the function full(speye(5)) has the same function as the function eye(5).**unit test 2**

1、the statement which can create the third order magic matrix is ( ).

a、m=magic(3)

b、m=magic(3)

c、m=magic(3)

d、m=magic(1,3)

2、the statement which can create the 5th order matrix a composed of double-digit random integers is ( ).

a、a= fix(10 89*rand(5))

b、a= fix(20 90*rand(5,5))

c、a= fix(10 90*rand(5))

d、a=fix(10 100*rand(5))

3、the statement which can create the diagonal matrix p with (x y)^5 expansion coefficient is ( ).

a、p=diag(flipud(pascal(6)))

b、p=diag(diag(flipud(pascal(6))))

c、p=diag(flipud(pascal(5)))

d、p=diag(diag(flipud(pascal(5))))

4、the expression which can make the diagonal elements of matrix a plus 30 is ( ).

a、a 30*eye(size(a))

b、a 30*eye(a)

c、a 30*ones(size(a))

d、a 30*eye(4)

5、after the statement [x,d]=eig(a) is executed, d is a ( ).

a、triangular matrix

b、diagonal matrix

c、scalar matrix

d、identity matrix

6、the main purpose of using sparse storage is ( ).

a、change storage order

b、improve operation precision

c、save memory space

d、design efficient algorithm

7、after executing statement a=sparse([0,2,5;2,0,1]), the last line of the output result is ( ).

a、(2,1) 2

b、(1,2) 2

c、(1,3) 5

d、(2,3) 1

8、the statement which can create the third order matrix of ones a are ( ).

a、a=[ones(3,1), ones(3,1), ones(3,1)]

b、a=ones(3)

c、a=diag(eye(3))*ones(1,3)

d、a=ones(3,3)

9、among the following choices, of which two command results are same to each other? ( ).

a、x=(-2:2)' and x=[-2:2]'

b、x=diag(diag(ones(3))) and x=eye(3)

c、x=triu(a,1) tril(a,-1) and x=a-diag(diag(a))

d、x=rot90(a) and x=fliplr(a)

10、matrix trace is equal to the sum of the diagonal elements of the matrix. the command which can figure out matrix trace are ( ).

a、trace(a)

b、sum(diag(a))

c、prod(eig(a))

d、sum(eig(a))

11、given a matrix and c matrix, the commands that can be used to change from a to c are ( ).

a、c=reshape(a,4,3)

b、c= a’

c、c=rot90(a,3)

d、c=rot90(a,-1)

12、sparse matrix must adopt sparse storage method.

13、the function speye(5) has the same function as the function sparse(eye (5)).**chapter 3 matlab program flow control****3.1 programming with sequence structure随堂测验**

1、any complicated program consists of three basic structures: sequence structure, selection structure and loop structure.

2、in matlab, the extension of script files is .m, so the script files are also called m files.

3、in the command window, you can either directly run the function file or call it in the way of function call.**3.2 selection structure with the if statement随堂测验**

1、the option with the condition true is ( ).

a、[1, 2; 0, 4]

b、[ ]

c、[1, 2; 3, 4]

d、0

2、the output of the following program is ( ). y=30; if y==30 y=y*2; elseif y>0 y=10 end disp(y)

a、1

b、30

c、10

d、60

3、no matter how many branches there are in a if statement with multi-branches , after the program executes one branch, the remaining branches will not be executed again, and then the entire if statement ends.**3.3 selection structure with the switch statement随堂测验**

1、in the switch statement, case result list is the value of switch expression. when there are multiple values, use ( ) to represent.

a、structured data

b、numerical data

c、enumerated data

d、cell data

2、the output of the following program is（ ）. a=1; switch a case 3|4 disp('perfect') case {1,2} disp('ok') otherwise disp('no') end

a、ok

b、perfect

c、no

d、2

3、in many cases, switch statement and if statement with multiple branches can be used interchangeably.**3.4 loop structure with the for statement随堂测验**

1、the following statement loops ( ) times. for k=2:-2:13 k end

a、0

b、6

c、13

d、1

2、suppose the statement： a=eye(6); for n=a(3:end,:) n endthe number of times of the for loop is ( ).

a、3

b、4

c、5

d、6

3、after exiting the loop, the value of k is ( ). for k=1:3:11 end k

a、3

b、11

c、10

d、7

4、suppose the program： x=reshape(1:12,3,4); m=0; n=0; for k=1:4 if x(:,k)<=6 m=m 1; else n=n 1; end endafter the program is executed, the values of m and n respectively are ( ).

a、6，6

b、2，1

c、2，2

d、1，2**3.5 loop structure with the while statement随堂测验**

1、suppose the program： k=10; while k k=k-1 endand the correct one in the following description is ( ).

a、execute the while loop 10 times

b、the loop is an infinite loop

c、the statements of loop will not be executed

d、the statements of loop will be executed once.

2、the output of the following program is ( ). s=0; for i=1:10 if rem(i,2)==0 continue end if rem(i,7)==0 break end s=s i; end disp(s)

a、3

b、9

c、10

d、7

3、the break statement is used to close the current loop, and the statement continue is used to close the whole loop.**3.6 definition and call of function file随堂测验**

1、execute the following commands. the wrong descriptions is ( ). >> clear >> [email protected]; >> a=fcos(pi);

a、the value of a is -1.

b、the value of a is equal to the value of cosd(180).

c、the value of a is equal to the value of cos(pi).

d、the value of a is uncertain.

2、after the following statements are executed, the value of variable a is ( ). >> f=@(x,y) 2*(x y); >> a=f(2,3);

a、2,3

b、3

c、10

d、5

3、if the name of function file is different from the function name, matlab will ignore the name of the function file and use the function name when calling the function.**3.7 recursive call of function随堂测验**

1、after executing the following script file, the output is ( ). function file fib.m： function f=fib(n) if n>2 f=fib(n-1) fib(n-2); else f=1; endscript file： f=[]; for k=1:6 f=[f,fib(k)]; end disp(f(k))

a、2

b、3

c、5

d、8

2、there are two kinds of methods to call recursion in a function, one is direct recursion, the other is indirect recursion.

3、calling recursion also can reduce the storage space and execution time and improve the execution efficiency of the program.**3.8 function arguments and variable scope随堂测验**

1、define a function file test.m： function fout=test(a,b,c) if nargin==1 fout=2*a; elseif nargin==2 fout=2*(a b); elseif nargin==3 fout=2*(a.*b.*c); endthe result of calling the test function in the command window is ( ). >> test(1:3,[-1,0,3])

a、2 4 6

b、0 3 3

c、-2 6 12

d、0 4 12

2、the variables defined in a function file are global variables.

3、matlab has two predefined variables nargin and nargout. when calling a function,those variables can record this function’s number of input arguments and output arguments.**unit test 3**

1、in the switch statement, the case result list is the value of the switch expression. when there are multiple values, it is indicated by ( ).

a、structured data

b、numerical data

c、enumerated data

d、cell data

2、the output of the following program is ( ). a=1; switch a case 3|4 disp('perfect') case {1,2} disp('ok') otherwise disp('no') end

a、ok

b、perfect

c、no

d、2

3、look at the following two for loops. the correct option is ( ). loop 1： for k=[12,3,1,0] … endloop 2： for k=[12;3;1;0] … end

a、loop 1 loops 4 times，loop 2 loops 1 time.

b、loop 1 loops 1 time，loop 2 loops 4 times.

c、loop 1 and loop 2 both loop 4 times.

d、loop 1 and loop 2 both loop 1 time.

4、suppose the program： k=10; while k k=k-1; end kafter the program is executed, k is ( ).

a、10

b、1

c、0

d、-1

5、define a function file fun.m： function f=fun(n) f=sum(n.*(n 1));the result of calling the fun function in the command window is ( ). >> fun(1:5)

a、30

b、50

c、65

d、70

6、define a function file fsum.m： function s=fsum(n) if n<=1 s=1; else s=fsum(n-1) n; endthe result of calling the fsum function in the command window is ( ). >> fsum(10)

a、45

b、55

c、65

d、75

7、define a function file test.m： function fout=test(a,b,c) if nargin==1 fout=2*a; elseif nargin==2 fout=2*(a b); elseif nargin==3 fout=2*(a.*b.*c); endthe result of calling the test function in the command window is ( ). >> test(1:3,[-1,0,3])

a、2 4 6

b、0 3 3

c、-2 6 12

d、0 4 12

8、to figure out the value of the piecewise function, the correct programs are ( ).

a、x=input('x=:'); y=(x 10)*(x>0) (x-10)*(x<=0); disp(y)

b、x=input('x=:'); y=x 10; if x<=0 y=x-10; end disp(y)

c、x=input('x=:'); if x>0 y=x 10; else y=x-10; end disp(y)

d、x=input('x=:'); if x>0 y=x 10; elseif x<=0 y=x-10; end disp(y)

9、after executing the following statement, the correct descriptions are ( ). >> clear >> [email protected]; >> a=fcos(pi);

a、the value of a is uncertain.

b、the value of a is -1.

c、the value of a is equal to the value of cosd(180).

d、the value of a is equal to the value of cos(pi).

10、find the value of y. the correct scripts are ( ).

a、y=2.^(0:20); sum(y)

b、y=2^[0:20]; sum(y)

c、y=1; for k=1:20 y=y 2^k; end y

d、y=[1]; for k=1:20 y=[y, 2^k]; end sum(y)

11、define a function that returns the perimeter and area of a circle according to its radius. the correct options are ( ).

a、function [p,s]=fcircle(r) p=2*pi*r; s=pi*r*r;

b、function out=fcircle(r) out=[2*pi*r; pi*r*r];

c、fcircle=@(r) [2*pi*r; pi*r*r];

d、[p,s]=@(r) [2*pi*r; pi*r*r];

12、in many cases, the for statement and the while statement can replace each other.

13、the function itself is called in the definition of a function. this is the recursive call of the function.**chapter 4 matlab plotting****4.1 2-d line plots随堂测验**

1、if x and y are both 4×3 matrices, the number of curves drawn in the figure window is ( ) after executing the plot(x,y) command.

a、12

b、7

c、4

d、3

2、when setting the color of curve，the color that character b represents is ( ).

a、red

b、green

c、blue

d、black

3、let a be a 100×2 numerical matrix. if you want to draw a curve with the first column data of a as abscissa and the second column data of a as ordinate, the command is ( ).

a、plot(a(:,1),a(:,2))

b、plot(a)

c、plot(a(1,:),a(2,:))

d、plot(a(1),a(2))

4、if x is an m×n matrix, the command of plot(x) draws a line for each row of the matrix and the total number of lines is m.**4.2 formatting and annotation随堂测验**

1、the command to display the grid in the figure window is ( ).

a、hold on

b、box on

c、grid on

d、figure

2、a figure window is divided into 2×3 subplots, and the command is ( ) to specify the upper middle subplot.

a、subplot(2,3,1)

b、subplot(2,3,2)

c、subplot(2,3,3)

d、subplot(2,3,4)

3、after executing the following command, the result is ( ).x=0:pi/100:2*pi; for n=1:2:10 plot(n*sin(x),n*cos(x)) hold on end axis square

a、five concentric circles

b、five parallel lines

c、one sine and one cosine

d、five sines and five cosines

4、the function text can be used to label the axes.**4.3 other 2-d plots随堂测验**

1、the function to draw a bar graph is ( ).

a、polar

b、pie

c、bar

d、area

2、the function to draw the polar graph is ( ).

a、plot

b、polar

c、rose

d、fplot

3、to make the curve of function y=e^x draw straight line, the plotting function should be ( ).

a、plot

b、semilogx

c、semiology

d、loglog

4、there are the following commands: x=1:0.1:2; y=2.^(0.1 1.2*log(x));when calling the command loglog(x,y), a straight line will be drawn.**4.4 3-d line plots随堂测验**

1、after executing the following command, the resulting graph is ( ). x = 0:pi/50:10*pi; y=cos(x); z=sin(x) plot3(z,y,x) grid on axis square

a、

b、

c、

d、

2、there are the following commands: t = linspace(0,20*pi, 501); plot3(t.*sin(t), t.*cos(t), t);after executing the above command, the graphic on the left can be drawn. the command you can use to draw the right graphic is ( ).

a、plot3(t.*sin(t),t.*cos(t),t); hold on plot3(t.*sin(t), t.*cos(t), -t);

b、plot3(t.*sin(t),t.*cos(t),t,t.*sin(t),t.*cos(t),-t);

c、plot3(t.*sin(t),t.*cos(t),[t;-t]);

d、plot3(t.*sin(t),t.*cos(t),[t,-t]);

3、after running the following program and three straight lines can be drawn.x=[1,2,3]; y=[1,2,3]; z=[1,2,3]; plot3(x,y,z,'b')**4.5 3-d surface plots随堂测验**

1、after running the following program,the result is ( ). [x,y]=meshgrid(1:5); surf(x,y,5*ones(size(x)));

a、plane z=x y

b、plane parallel to xy plane

c、plane perpendicular to xy plane

d、plane z=5x

2、the graph drawn by the meshc function is ( ).

a、

b、

c、

d、

3、the function mesh takes x as the x-coordinate,y as the y-coordinate, and use m × n combinations of x and y to construct the grid points, calculates the z value on the point (x,y), and then draws points above the points with z as the vertical coordinate, connects four adjacent points with straight lines to form a curved grid, and finally draws a 3-d grid graph to express the function z=f(x,y).**4.6 graphics decoration随堂测验**

1、after running the following program, the graph is ( ). [x,y,z]=cylinder(10,40); surf(x,y,z) view(90,0); axis square

a、a solid circle

b、a hollow circle

c、a rectangular

d、a cylindrical

2、after running the following program, the graph is ( ). [x,y]=meshgrid(-2:2); z=x y; i=find(abs(x)<1 & abs(y)<1); z(i)=nan; surf(x,y,z);shading interp

a、cut a small square in the center of a square

b、cut a small rectangle in the center of a square

c、cut a small square at the top of a square

d、cut a small square at the bottom of a square

3、after running the following program, the graph is ( ). [x,y,z]=sphere; m=[0 0 1]; z(find(z>0))=nan; surf(x,y,z) colormap(m) axis equal

a、half a blue sphere

b、a blue circular ring

c、a blue circle

d、a blue cylinder**4.7 interactive plotting tools随堂测验**

1、before plotting with the command button in the plots tab, you need to ( ).

a、enter the plotting command in the command window

b、select the plotting variable in the workspace

c、open the figure window

d、create m file

2、a figure window can display only one graph.

3、plotting is independent of the order in which variables are selected in the workspace.

4、you cannot add 2-d plots on the same axis where a 3-d graph is existing.**unit test 4**

1、if x and y are both 5×6 matrices, the number of curves drawn in the figure window is ( ) after executing the plot(x,y) command.

a、5

b、6

c、11

d、30

2、the result of the following program is ( ).x=[0,1,1,0,0]; y=[0,0,1,1,0]; for n=1:3 plot(n*x,n*y) hold on end axis equal

a、3 rectangles with lower-left corner at the origin

b、3 rectangles with center at origin

c、3 straight lines

d、15 points

3、after the command text(1,1,'{alpha}\leq{2pi}') is executed, the annotation effect is ( ).

a、{alpha}\leq{2pi}

b、α≥2π

c、α≤ 2π

d、{α}\leq{2π}

4、the command subplot(2,2,3) is the subplot of ( ).

a、a lower-left graph of two rows and two columns

b、a lower-right graph of two rows and two columns

c、a upper-left graph of two rows and two columns

d、a upper-right graph of two rows and two columns

5、to make the function y=lnx plotted as a straight line, the plotting function should be ( ).

a、polar

b、semilogx

c、semilogy

d、loglog

6、the result of the following program is ( ).[x, y] = meshgrid(1:5); surf(x, 5*ones(size(x)), y);

a、z=y plane

b、a plane parallel to xy plane

c、a plane perpendicular to xy plane

d、y=5x plane

7、which of the following functions can not be used to draw the scatter plots ( ).

a、scatter

b、stairs

c、stem

d、pie

8、after running the following program, the graph you see is ( ).t=0:pi/6:2*pi; [x,y,z]=cylinder(t, 6); surf(x,y,z) view(0,90); axis equal

a、6 concentric circle

b、6 concentric hexagon

c、12 concentric circle

d、12 concentric hexagons

9、after running the following program, we get the graph ( ). [x,y]=meshgrid(-2:2); z=x y; i=find(abs(x)<1 & abs(y)<1); z(i)=nan; surf(x,y,z);shading interp

a、scoop out a small square in the center of a square

b、scoop out a small rectangle in the center of a square

c、scoop out a small square at the top of a squar

d、scoop out a small square at the bottom of a square

10、before plotting with the command button in the "plots" tab, you need to ( ).

a、open the figure window

b、create m file

c、input the plotting command in the command window

d、select the plotting variable in the workspace

11、to draw a sine curve in the interval of 0≤x≤2π, the commands available are ( ).

a、x=linspace(0,2*pi,100); plot(x,sin(x));

b、x=linspace(0,2*pi,100)'; plot(x,sin(x));

c、x=linspace(0,2*pi,100)'; x=[x,sin(x)]; plot(x);

d、fplot(@(x) sin(x),[0,2*pi]);

12、when plotting the sine and cosine curves of [0,2π] simultaneously in a figure window, we can use the command ( ).

a、x=(0:0.01:2*pi)'; y=[sin(x),cos(x)]; plot(x,y);

b、x=0:0.01:2*pi; y=[sin(x);cos(x)]; plot(x,y);

c、fplot(@(x)sin(x),@(x)cos(x),[0,2*pi]);

d、fplot(@(x)[sin(x),cos(x)],[0,2*pi]);

13、after executing the command colormap(gray(6)), the graphs drawn with the surf function are described in six different concentrations of gray.

14、when calling the fplot3 function to create a space curve, we need to first calculate the coordinates of the points on the curve.**chapter 5 data analysis and polynomial evaluation****5.1 statistical analysis of data随堂测验**

1、if x is a row vector, after running the statement [a,b]=min(x), the sequence number of the smallest element in the vector is stored in ( ).

a、a

b、b

c、neither a nor b

d、both a and b

2、if a=[1,2,3,4,5;3,4,5,6,7], the value of function min(max(a)) is ( ).

a、1

b、3

c、5

d、7

3、if a is a 3×3 matrix, the function of the function mean(a) is ( ).

a、to calculate the average of each row of a

b、to calculate the average of each column of a

c、to increase a row of the average for a

d、to increase a column of the average for a

4、for the matrix a, the maximum element in the row can be achieved by the function max (a,2).

5、if x is a vector and a=std(x), the greater the value of a is, the greater the deviation from its average of elements in the vector is.**5.2 polynomial evaluation随堂测验**

1、if a and b are polynomial vectors, a=[1,2] and b=[3,4,5], when adding the two polynomials, which one in the following is correct. ( )

a、a b

b、[a,0] b

c、[0,a] b

d、none of the above

2、if p is a polynomial coefficient vector and x is a matrix, if you want to calculate the polynomial function value of each element in x, which one in the following is correct. ( )

a、polyval(p,x)

b、polyvalm(p,x)

c、polyfit(p,x)

d、polyder(p,x)

3、if p is a polynomial coefficient vector and x is an independent variable, the function of roots(p) is ( ).

a、to evaluate the value of polynomial when x=0

b、to take the derived function of the polynomial

c、to calculate the roots of the polynomial equation

d、none of the above

4、enter the following commands in the command window:>> x=[1,2,3,4]; >> y=polyval(x,1); the value of y is ( ).

a、5

b、8

c、24

d、10

5、if p=[1,2,3] is a polynomial coefficient vector, the constant term of the polynomial is 1.**5.3 data interpolation随堂测验**

1、in the method of nearest point interpolation, if the interpolation point is located in the middle of two sampling points, the value of the interpolation point is ( ).

a、the value of the function at the previous adjacent point

b、the value of the function at the last adjacent point

c、the average value of the function at two adjacent points

d、none of the above

2、the method which is not supported by 2-d interpolation is ( ).

a、linear

b、nearest

c、pchip

d、spline

3、data interpolation method is a method of function approximation, so there is a global approximation function.

4、among four interpolation methods of linear, nearest, pchip and spline, the spline is the best.

5、when the polynomial is used for interpolation calculation, the higher the degree of the polynomial is, the more accurate the interpolation calculation is.**5.4 examples of data interpolation application随堂测验**

1、in the engineering field, if only some discrete sample points in a continuous region are measured, the most appropriate method to obtain more values in the interval of sample points is ( ).

a、the method of solving equations

b、the method of data interpolation

c、an experiment or test method

d、the method of manual estimation

2、when using interpolation method to draw topographic map, for making the topographic map more smooth, it is necessary to（ ）。

a、increase sampling points

b、increases the accuracy of sample values

c、modify the graphic coloring

d、none of the above

3、since the data can be estimated by numerical interpolation, there is no need to obtain data through experiments or tests.

4、data interpolation can be used to estimate unknown data of the sampling interval by using known data.**5.5 curve fitting随堂测验**

1、among the numerical computation methods learned in this section, the one that can be used to predict the future trend of temporal data is ( ).

a、data statistics

b、polynomial calculation

c、data interpolation

d、curve fitting

2、the data which is calculated by method of curve fitting is more accurate than those calculated by the method of data interpolation.

3、the polynomial function which used for fitting curve can only be polynomial of the third degree.**5.6 examples of curve fitting application随堂测验**

1、in the methods of data interpolation and curve fitting, the method where the curve must pass through all sample points is ( ).

a、data interpolation

b、curve fitting

c、both a and b

d、neither a nor b

2、when predicting the future development trend of stock data by the method of curve fitting, the obtained information is completely reliable.

3、when there are errors in the sample data obtained by experiment or test, it is suitable to use curve fitting to estimate other data.**unit test 5**

1、if a is a matrix, the function of the function max(a(:)) is ( ).

a、to work out the maximum element of the entire matrix

b、function call errors

c、to work out the maximum element of each row of the matrix

d、to work out the maximum element of each column of the matrix

2、let p be a vector of polynomial coefficients and a be a square matrix, about the values of polyval(p,a) and polyvalm(p,a), ( ).

a、one is a scalar, another is a square matrix

b、both are scalars

c、the two values are equal

d、the two values are not equal

3、input the following commands in the command window:>> a=[1,0,-2]; >> x=roots(a); then the value of x(1) is ( ).

a、1

b、-2

c、1.4142

d、-1.4142

4、among the following four methods of data interpolation, which method is shape preserving？( )

a、linear

b、nearest

c、pchip

d、spline

5、which of the following functions is usually uesd for curve fitting? ( )

a、the random function

b、the polynomial function

c、the exponential function

d、the trigonometric function

6、the minimum error in the least square method refers to ( ).

a、the minimum mean value of errors

b、the minimum sum of errors

c、the minimum sum of squares of errors

d、the minimum product of errors

7、when there are errors in the sample data obtained from experiments or tests, the appropriate method to estimate other data is ( ).

a、data interpolation

b、curve fitting

c、solve equation

d、none of the above

8、suppose that there are three polynomials, whose coefficient vectors are q, r and s respectively. to work out their products, the following commands that can be used include ( ).

a、conv(conv(q,r),s)

b、conv(q,conv(r,s))

c、conv(conv(s,r),q)

d、conv(q,r,s)

9、both a and b are vectors of polynomial coefficients, and a=[1,2], b=[3,4,5]. to add the two polynomials, which of the following is incorrect. ( )

a、a b

b、[0,a] b

c、[a,0] b

d、a b(1:2)

10、among the following four methods of data interpolation, the method that passes every sample point is ( ).

a、linear

b、nearest

c、pchip

d、spline

11、which of the following are the functions of curve fitting.( )

a、estimate data

b、predict trend

c、summarize rules

d、prove theorem

12、if a certain vector of polynomial coefficients contains five elements, then the polynomial is a polynomial of degree 5.

13、data interpolation can estimate the unknown data in the sampling interval with the known data.**chapter 6 numerical calculus and solutions of equations****6.1 numerical differentiation and integration随堂测验**

1、after executing the statement i=trapz([1,2], [7,9]), the value of i is ( ).

a、7

b、8

c、9

d、10

2、to calculate the second-order forward difference of the row vector x, the functions that can be used are ( ).

a、diff(x,2)

b、diff(diff(x))

c、diff(diff(x,1))

d、diff(x,2,2)

3、the difference quotient of the function f(x) at some point is an approximation of its derivative.**6.2 solve system of linear equations随堂测验**

1、for solving system of linear equations ax=b, when det(a)≠0, the solution of the equation is ( ).

a、a\b

b、b/a

c、b\a

d、a/b

2、for system of linear equations ax= b, if a=lu is an lu decomposition of a, then the solution of system of linear equations is ( ).

a、x=u\(l\b)

b、x=u\l\b

c、x=(u\l)\b

d、x=u/l/b

3、the convergence performance of gauss-seidel iterative method is better than that of jacobi iterative method.

4、both the matrix inverse function and the operator of left division can be used to solve system of linear equations, but the inverse method requires more computation, and the left division operation only has one division operation.**6.3 application examples of system of linear equations随堂测验**

1、for the system of linear equations with large order and more zero elements of coefficient matrix a, it is very suitable to use ( ) to solve.

a、direct method

b、iterative method

c、matrix inversion

d、left division

2、the one which is related to solving system of linear equations among the following methods is ( ).

a、left division

b、matrix inversion

c、matrix transpose

d、matrix decomposition

3、the direct method is generally suitable for solving low order and dense system of linear equations.**6.4 solve nonlinear equation and find extreme value of function随堂测验**

1、find the root of the equation near 0.5, the corresponding command is ( ).

a、fx=@(x) x-sin(x)/x; z=fzero(fx,0.5)

b、z=fzero(@(x) x-sin(x)/x,0.5)

c、fx=@(x) x-sin(x)/x; z=fsolve(fx,0.5)

d、z=fsolve(@(x) x-sin(x)/x,0.5)

2、find the minimum value of f(x)=x sin(2x-1) near 0, the corresponding command is ( ).

a、[x,fval] = fminbnd(@(x) x*sin(2*x-1),0,0.5)

b、[x,fval] = fminsearch(@(x) x*sin(2*x-1),0)

c、[x,fval] = fminsearch(@(x) x*sin(2*x-1),0.5)

d、[x,fval] = fminunc(@(x) x*sin(2*x-1),0)

3、in matlab, the fzero function is used to find the roots of univariate nonlinear equations, while the fsolve function can find the numerical solutions of nonlinear equations.**6.5 numerical solution for ordinary differential equations随堂测验**

1、find the numerical solution of ordinary differential equations in the interval [1,3], the correct command is ( ).

a、>> f=@(x, y) 2*x/y 2*x; >> [x, y]=ode45(@f, [1, 3], 1)

b、>> f=@(x, y) 2*x/y 2*x; >> [x, y]=ode45(f, [1, 3], 1)

c、>> [x, y]=ode45(@(x, y) 2*x/y 2*x, [1, 3], 1)

d、create the f.m function file： function yx=f(x,y) yx=2*x/y 2*x; input command： >> [x, y]=ode45(@f, [1, 3], 1)

2、when solving the numerical solution of the higher order ordinary differential equation, it is necessary to transform it into the first order ordinary differential equations, namely the equation of state.**6.6 application examples of ordinary differential equations随堂测验**

1、the one that cannot be used to find numerical solutions of ordinary differential equations among the following functions is ( ).

a、ode23

b、ode34

c、ode45

d、ode113

2、matlab provides a kind of ode series functions to find numerical solutions of ordinary differential equations, among which the function applicable to the stiff problems is ( ).

a、ode23

b、ode45

c、ode113

d、ode23s

3、both the functions of ode23 and ode45 adopt runge-kutta algorithm.**unit test 6**

1、after the following statement is executed, the value of i is ( ). i=integral(@(x) x,0,1)

a、0

b、1

c、0.5

d、-1

2、for a system of linear equations ax = b, when det(a) ≠ 0, the solution of the equation is ( ).

a、a/b

b、b/a

c、b\a

d、a\b

3、for a system of linear equations of large sparse matrix with high order and many zero elements of coefficient matrix a, the most suitable method to solve the equation is ( ).

a、direct method

b、iterative method

c、matrix inversion

d、left division

4、the following function that cannot be used to find the numerical solution of ordinary differential equation is ( ).

a、ode23

b、ode34

c、ode45

d、ode113

5、find the minimum value of f(x)=x sin(2x-1) around 0, the corresponding command is ( ) .

a、[x,fval]=fminbnd(@(x) x*sin(2*x-1),0,0.5)

b、[x,fval]=fminbnd(@(x) x*sin(2*x-1),0)

c、[x,fval]=fminsearch(@(x) x*sin(2*x-1),[0,0.5])

d、[x,fval]=fminunc(@(x) x*sin(2*x-1),[0,0.5])

6、the following commands ( ) can be used to calculate the first-order forward difference of vector x.

a、diff(x)

b、diff(x,1)

c、diff(x,1,2)

d、a=x(1:end-1); b=x(2:end); b-a

7、the following commands ( ) can be used to find the solution to the equation within [4,6].

a、>> fx=@(x) exp(x)-3*x*x-15; >> z=fzero(fx,5)

b、>> z=fzero(@(x) exp(x)-3*x*x-15,5)

c、create the function file fx.m.function f=fx(x) f=exp(x)-3*x*x-15; call the function file： >> z=fzero(@fx,5)

d、create the function file fx.m.function f=fx(x) f=exp(x)-3*x*x-15; call the function file：>> [email protected]; >> z=fzero(f,5)

8、take the initial value as (1, 1, 1); the following commands ( ) can be used to find the solution to the system of equations.

a、f=@(x) [x(1)^3 x(2)-x(3)-5; 2*x(1) 3*x(2)^2-6; x(1) x(2) x(3)-3]; x=fsolve(f,[1,1,1],optimset('display','off'))

b、x=fsolve(@(x) [x(1)^3 x(2)-x(3)-5; 2*x(1) 3*x(2)^2-6; x(1) x(2) x(3)-3],[1,1,1])

c、f=@(x) [x(1)^3 x(2)-x(3)-5; 2*x(1) 3*x(2)^2-6; x(1) x(2) x(3)-3]; x=fzero(f,[1,1,1])

d、x=fzero(@(x) [x(1)^3 x(2)-x(3)-5; 2*x(1) 3*x(2)^2-6; x(1) x(2) x(3)-3],[1,1,1])

9、the following commands ( ) can be used to find the solution to the system of ordinary differential equations.

a、create the function file ty.m.function dy=ty(t, y) dy=[y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)]; call the function file：>> [t, y]=ode45(@ty, [0, 12], [0, 1, 1]); >> plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

b、create the function file ty.m.function dy=ty(t, y) dy=[ y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)]; call the function file：>> clear >> [email protected]; >> [t, y]=ode45(h, [0, 12], [0, 1, 1]); >> plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

c、ty=@(t, y) [ y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)]; [t, y]=ode45(ty, [0, 12], [0, 1, 1]); plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

d、[t, y]=ode45(@(t, y) [ y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)], [0, 12], [0, 1, 1]); plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

10、the difference quotient of the function f(x) at a certain point serves as an approximation of its derivative.

11、the convergence performance of gauss-seidel iterative method is better than jacobi iterative method.

12、in matlab, the fzero function is used to find the roots of single variable nonlinear equations, while the fsolve function can find the numeric solutions to systems of nonlinear equations.

13、there is a type of ordinary differential equations; the components of its solutions vary rapidly, or sometimes slowly, with great differences. this is the so-called ill-conditioned equations problem.**chapter 7 matlab symbolic computations****7.1 symbolic objects随堂测验**

1、input the statements a=1 and x=sym('a') in matlab, and the correct one among the following statement is ( ).

a、x is a symbolic constant.

b、x is a symbolic variable.

c、x is a numerical variable.

d、there is an error in the definition of x.

2、if a=sym(4), the value of 1/a 1/a is ( ).

a、0.5

b、1/2

c、1/4 1/4

d、2/a

3、the value of function factor(sym(15)) is ( ).

a、'15'

b、15

c、[ 1, 3, 5]

d、[ 3, 5]

4、the function factor() can be used to determine if a positive integer is a prime number.

5、when the coeffs() function is used to extract the coefficients of the symbolic polynomial, the order of the coefficients is from high degree to low degree.

6、when there is only one symbol variable in the symbolic polynomial, the sym2poly() function can be used to convert the symbolic polynomial into the polynomial coefficient vector.**7.2 symbolic calculus随堂测验**

1、enter the following commands in the command window:>> f=sym(1); >> eval(int(f,1,4)) after running the commands, the result is ( ).

a、3

b、4

c、5

d、1

2、the diff function can be used to evaluate the partial derivative of a symbolic function.

3、when using the function int() to evaluate the definite integral, if there is a symbolic variable in the upper or lower limit of the integral, the integrand is not integrable.**7.3 series随堂测验**

1、the function which expands the function into a power series in matlab is ( ).

a、tailor

b、tayler

c、diff

d、taylor

2、when using the command taylor(f,x,1,'order',6) to take the taylor expansion of f, the highest degree of the expansion is ( ).

a、5

b、6

c、7

d、3

3、when doing taylor expansion, if the expansion point is not specified, then ( ).

a、the expansion point is 0

b、the expansion point is 1

c、can't do the expansion

d、the expansion point is a random number

4、when using the symsum() function to sum the series, if it can be summed within the range of [1, inf], it must also be summable within the range of [1, 1000].**7.4 solving symbolic equations随堂测验**

1、the matlab's function which is used to solve the symbolic ordinary differential equation is ( ).

a、solve

b、solver

c、dsolve

d、dsolver

2、in the dsolve() function, if no independent variable is specified, the default independent variable is ( ).

a、a

b、x

c、i

d、t

3、as long as equations or systems of equation have solutions, the solve function can surely be able to work out the correct solutions.

4、when using dsolve() function to solve ordinary differential equations, if initial conditions are given, the particular solution of the equations can be obtained. if the initial conditions are not given, the general solution of the equations can be obtained.**unit test 7**

1、if there are statements a = sym(1); b = 1; x = sym('b '), the correct description is ( ).

a、both a and x are symbolic constants.

b、both a and x are symbolic variables.

c、a is a symbolic constant, while x is a symbolic variable.

d、x is a symbolic constant, while a is a symbolic variable.

2、the value of the function factor(sym(12)) is ( ).

a、'12'

b、12

c、[3, 4]

d、[ 2, 2, 3]

3、if no master variable is specified, the default master variable in symbolic expression of a*x b*y t is ( ).

a、a

b、b

c、x

d、t

4、input the following commands in the command window:>> f=sym(1); >> eval(int(f,1,4)) then the output result after command execution is ( ).

a、3

b、4

c、5

d、1

5、if the command of taylor(f,x,1,'order',6) is used to perform the taylor series expansion of f，the highest degree of the expansion is ( ).

a、5

b、6

c、7

d、3

6、if no independent variable is specified in the dsolve function, the default independent variable is ( ).

a、a

b、x

c、i

d、t

7、which of the following is true about the determination of the master variable in symbolic operation? ( )

a、if the master variable is not specified, matlab will take the lowercase letter nearest to x in alphabetical order except for i and j as the master variable.

b、when there is x in a symbolic expression and the expression specifies no master variable, the system's default master variable is x.

c、if there are multiple variables in the symbolic expression s, the function symvar(s) will return a system's default master variable.

d、if there is no x in a symbol expression, but the expression includes y and z, then matlab will take z as the master variable by defualt.

8、for a polynomial equation, which of the following function can be used to solve it?（ ）

a、roots()

b、solve()

c、dsolve()

d、diff()

9、the factor function can be used to determine whether a positive integer is a prime number.

10、when the coeffs function is used to extract the coefficients of a symbol expression, the order of coefficients is from high degree to low degree.

11、when using the int function to evaluate definite integral, if the upper limit or lower limit of the integral is a symbolic expression, the integrand function is not integrable.

12、when using the symsum function to perform summation of series, if a series can be summed within [1, inf], then certainly, it can also be summed within [1, 1000].

13、taylor series expansion is able to convert complex operations into the simple four arithmetic operations, and the precision is enough for most engineering applications as long as the first finite terms of a series are taken.

14、as long as equation or system of equations have solutions, the solve() function can surely be able to work out the correct solutions.**chapter 8 matlab graphical user interface design****8.1 figure and axes随堂测验**

1、the function which is used to get the handle of the current figure window is ( ).

a、gca

b、gcf

c、gco

d、gcw

2、if you want to specify that the length of the figure window object is measured in centimeter, the value of units attribute is ( ).

a、pixels

b、normalized

c、centimeters

d、points

3、in matlab, the handle is used to identify the object and get the properties of the corresponding object by the handle.

4、the colororder property of the coordinate axis is a vector.

5、if you want to cancel the default menu of the figure window, you can set the menubar property of the figure window to none.**8.2 line and surface随堂测验**

1、as for the surface plotting by the surface function, the azimuth angle of view defaults to 0° and the elevation angle defaults to ( ).

a、0°

b、37.5°

c、60°

d、90°

2、after executing the following commands, the graph that we can get is（ ）。>> axes('view',[-37.5, 30]) >> surface(1:5, 1:5, 6*ones(5))

a、a column with a height of 6 in the region of [1,5]×[1,5]

b、a plane with a height of 6 in the region of [1,5]×[1,5]

c、a column with a height of 5 in the region of [1,6]×[1,6]

d、a plane with a height of 5 in the region of [1,6]×[1,6]

3、the equivalent commands in the following are ( ).

a、line(x,y,'color','r');

b、line(x,y,'r');

c、plot(x,y,'color','r');

d、plot(x,y,'r');

4、the plot function clears the original graph on the coordinate axis and redraws the new graph by default, while the line function overlays the new graph on the original graph by default.

5、in the function surface(x, y, z) if x is a vector with m elements and y is a vector with n elements, then the matrix z should be an n×m matrix.**8.3 ways to develop apps随堂测验**

1、the backgroundcolor and foregroundcolor properties of the control respectively represent ( ).

a、foreground and background colors

b、color of foreground and caption

c、color of caption and background

d、color of background and caption

2、the property which is used to define the response command after the control is selected is ( ).

a、string

b、command

c、callback

d、value

3、when defining a menu item, in order to make the menu item gray, set its enable attribute to ( ).

a、'on'

b、'off'

c、'yes'

d、'no'

4、when defining a menu item, in order to make the menu item gray, set its enable attribute to ( ).

a、'on'

b、'off'

c、'yes'

d、'no'

5、when creating a secondary menu item, the first argument of the uimenu function is the parent menu item’s handle.**8.4 app development using guide随堂测验**

1、in a group of buttons, usually only the one can be selected ,and if one of them is selected, the primary selected button will no longer be selected. this kind of button is called ( ).

a、button

b、radio button

c、check box

d、toggle button

2、the property which is used to define the control's identity is ( ).

a、string

b、tag

c、value

d、label

3、the type of file which is used to save the gui created by guide is ( ).

a、.m

b、.mat

c、.gui

d、.fig**8.5 app development using app designer随堂测验**

1、the file which is used to save the app application's program is ( ).

a、.app

b、.mlapp

c、.mat

d、.fig

2、the expression which is used to get the value's attribute value of the knob object knob1 is ( ).

a、knob.value

b、knob1.value

c、app.knob.value

d、app.knob1.value

3、the design view and code view of app designer have the same content in the properties panel.

4、design view of app designer is used for editing, debugging, and analyzing code.**8.6 examples of app development随堂测验**

1、the controls of the guide toolkit perform exactly the same functions and usage as common components of the app designer’s component library.

2、in the command of plot(app.uiaxes,x,y,'linewidth',0.1), the first argument is the object handle of coordinate axis.**unit test 8**

1、which function is used to get the current figure handle?( )

a、gca

b、gcf

c、gco

d、gcw

2、which is the default title when using the figure function to create a figure window?( )

a、figure window n（n is the number of figure window）

b、fig n（n is the number of figure window）

c、figure n（n is the number of figure window）

d、figure window n（n is the number of figure window）

3、which property is used to determine if the axis object has a border?( )

a、box

b、grid

c、position

d、font

4、among the following commands, which is not equivalent to the others that are equivalent to each other?( )

a、line(x,y,'color','r');

b、line(x,y,'r');

c、plot(x,y,'color','r');

d、plot(x,y,'r');

5、h representing a curve, which command you can use to set the color of it to red?( )

a、h.color='r';

b、h.color='r';

c、h.color='r';

d、h.linecolor='r';

6、which property is used to identify property for graphics object?( )

a、title

b、string

c、tag

d、label

7、what do the backgroundcolor property and the foregroundcolor property of control represent respectively?( )

a、foreground color and background color

b、foreground color and text color

c、text color and background color

d、background color and text color

8、which property is used to define the response to click operation of button?( )

a、string

b、command

c、callback

d、value

9、in order to specify the menu item as gray when defining it, you can set the enable property to ( ).

a、'on'

b、'off'

c、'yes'

d、'no'

10、which gui design tool is for checking and setting object properties?( )

a、the object property inspector

b、the toolbar editor

c、the object browser

d、the object property pane

11、the components provided by the component library of app designer include ( ).

a、figure window

b、axis

c、panel

d、knob

12、which program can you use to plot a 3-d surface: z=sin y cos x, x∈[0,2π], y∈[0,2π], in figure window?( )

a、x=0:pi/20:2*pi; [x,y]=meshgrid(x); z=sin(y).*cos(x); surf(x,y,z);

b、x=0:pi/20:2*pi; [x,y]=meshgrid(x); z=sin(y).*cos(x); surface(x,y,z); grid on; view(-30,37.5)

c、fx=@(x,y) x; fy=@(x,y) y; fz=@(x,y) sin(y).*cos(x); fsurf(fx,fy,fz,[0,2*pi])

d、fx=@(x,y) x; fy=@(x,y) y; fz=@(x,y) sin(y).*cos(x); surface(fx,fy,fz,[0,2*pi])

13、you can set menubar property of figure window to none when you need to cancel the default menu of figure window.

14、the position property of control is composed of two elements, namely the abscissa and ordinate values of left bottom corner of control which is relative to the figure window.**chapter 9 simulink system simulation****9.1 basic operations of simulink simulation随堂测验**

1、the integrator block is included in the ( ) block library.

a、sources

b、sinks

c、continuous

d、math operations

2、to copy a block in the same window of editing model, the incorrect method is ( ).

a、click the block which you want to copy, hold down the left button of mouse and meanwhile holding down the key of ctrl, move the mouse to the appropriate position and then release the mouse.

b、click the block which you want to copy, hold down the left button of mouse meanwhile holding down the key of shift, move the mouse to the appropriate position and then release the mouse.

c、in the window of editing model, select the command of edit→copy and edit→paste.

d、click the block which you want to copy by the right button of mouse, and select the commands of copy and paste from the shortcut menu.

3、after connecting the block, the method which can separate a wire is ( ).

a、move the mouse pointer to the branch point, hold down the left button of mouse and drag the point to the input end of the target block.

b、double click on the branch point, hold down the left button of mouse and drag the point to the input end of the target block.

c、move the mouse pointer to the branch point, hold down the shift key and mouse then drag the mouse to the input end of the target block.

d、move the mouse pointer to the branch point, hold down the ctrl key and mouse then drag the mouse to the input end of the target block.

4、simulink software cannot run without the environment of matlab.

5、the establishment of simulink simulation model is carried out in the window of "simulink library browser".**9.2 creation and mask of subsystem随堂测验**

1、the subsystem which is controlled by the control signal is called the ( ) subsystem.

a、conditionally executed

b、supervisory executed

c、control execution

d、trigger execution

2、customizing the dialog boxes of setting parameter and icon for subsystem to make the subsystem itself has a separate operation interface. this kind of operation is called the ( ) of the subsystem.

a、packaging

b、integration

c、mask

d、combination

3、the subsystem of conditional execution contains ( ).

a、enabled subsystem

b、triggered subsystem

c、event-driven subsystem

d、enabled and triggered subsystems

4、in the conditional execution subsystem, the output signal depends on the input and control signal.**9.3 design and application of the s-function随堂测验**

1、when using the s-function, you must add the block of ( ) to the model edit window.

a、sine wave

b、s-function

c、scope

d、s-program

2、in the following descriptions of the s-function, the correct descriptions are ( ).

a、the s-function is also called the system function

b、the matlab language can be used to write s-functions, can also use c or c language to write s-functions.

c、simulink block library can be extended by using s-function.

d、the s-function has ready-made files of template program.

3、when m file is used to write s-function, its template file contains 1 main function and 6 sub-functions.

4、s-function block cannot be masked.**9.4 example of simulink simulation application随堂测验**

1、if the simulation model is shown in figure (a), and the output result of oscilloscope is shown in figure (b). then the output result of 'xy graph' block is ( ).

a、sine curve

b、cosine curve

c、unit circle

d、ellipse

2、if parameters of the simulation model and sine wave block are set as follows. then the output waveform of the oscilloscope is ( ).

a、

b、

c、

d、

3、as for the second order differential equation,there can be two integrator blocks in the simulation model.

4、add an output port block (out block) to the simulation model, and this block can output the results to the matlab workspace.

5、the switch block in the signal routing block library can be used to implement a piecewise function.**unit test 9**

1、after the blocks are connected, if you want to separate a wire, do so by ( ).

a、moving the mouse pointer to the branch point and holding down the left mouse button to drag it to the input port of the target block

b、double-clicking the location of the branch point and holding down the left mouse button to drag it to the input port of the target block

c、moving the mouse pointer to the branch point, pressing ctrl and holding the mouse to drag to the input port of the target block

d、moving the mouse pointer to the branch point, pressing shift and holding the mouse to drag to the input port of the target block

2、by holding down a block on one model window and simultaneously pressing shift to move to another model window, ( ).

a、this block is in both model windows

b、this block in the latter window

c、this block is in the previous window

d、this block is in both windows with lines

3、customize the parameter setting dialogs and icons for the subsystem so that the subsystem itself has a separate operating interface, which is called the subsystem's ( ).

a、packaging

b、mask

c、integration

d、combination

4、while using the s-function, add ( ) to the model editing window.

a、sine wave block

b、s-program block

c、subsystem block

d、s-function block

5、the simulation model is shown in the figure, each block parameter is set by default, and then the output waveform of the oscilloscope is ( ).

a、

b、

c、

d、

6、the methods for starting simulink are to ( ).

a、enter the simulink command in the command window

b、on the home tab, click the simulink command button in the simulink command group.

c、on the home tab, click the new command button in the file command group

d、on the home tab, click the new script command button in the file command group

7、according to different control modes of controlling signal, the conditional execution subsystem is divided into ( ).

a、event-driven subsystem

b、enabled subsystem

c、triggered subsystem

d、enabled & triggered subsystems

8、which of the following descriptions of the s-function are correct? ( )

a、the simulink block library can be expanded using the s-function.

b、the s-functions can only be written in matlab.

c、the s-function has a ready-made block program.

d、the s-function block can be masked.

9、building the system simulation model is done in the simulink model edit window.

10、it is possible to convert sawtooth waves into square waves through the triggered subsystem.

11、the definite integral can be solved through simulink simulation.**chapter 10 external program interfaces****10.1 using matlab within excel随堂测验**

1、when a spreadsheet link program is loaded in an excel environment, the command group which is added to the ‘start’ tab in the excel window is ( ).

a、excel

b、spreadsheet

c、link

d、matlab

2、when exporting the excel sheet’s data to the matlab workspace, the kind of array that is generated in the matlab workspace is ( ).

a、double

b、cell

c、char

d、object

3、after installing the spreadsheet link with other matlab components, you can use matlab commands in excel without any settings.**10.2 file operations in matlab随堂测验**

1、the open mode of opening a readable and writable file is ( ).

a、w

b、r

c、rw

d、r

2、if the specified file cannot be opened by using the fopen function, the value which the function returns is ( ).

a、-1

b、0

c、1

d、2

3、the function that determines whether the file pointer has reached the end of the file is ( ).

a、ftell

b、fseek

c、feof

d、ferror

4、the functional character "%s" for reading and writing files specifies that data is read and written by the format of single.**10.3 read and write matlab data files from other language applications随堂测验**

1、among the following options, the one which is used to define the pointer to the mat file is ( ).

a、matfile *p;

b、mat *p;

c、file *p;

d、file *p;

2、the function which is used to open the mat file in a c program is ( ).

a、fopen

b、matopen

c、mexopen

d、matfileopen

3、the function which is used to manipulate the mxarray objects in c programs is ( ).

a、mex

b、mat

c、mx

d、array

4、in the c program for operating the mat files, the header file mat.h must be included.**10.4 calling functions in other languages from matlab随堂测验**

1、the mex function is declared in the header file of ( ).

a、mat.h

b、mex.h

c、mx.h

d、matlab.h

2、the gateway routine of mex source program is used to establish communication between the matlab system and the external subroutine to be called.

3、mex source program can be run directly in matlab.**10.5 calling matlab functions from other language applications随堂测验**

1、as for the matlab engine, the incorrect one among the following statements is ( ).

a、matlab functions can be called in the c program by using mtlab engine.

b、you can improve the efficiency of application development by using matlab engine.

c、you can call the functions written in c language directly in matlab by using matlab engine.

d、the execution efficiency of program that contains the matlab engine function is low.

2、the header file which define the matlab engine function of c is ( ).

a、mat.h

b、engine.h

c、mex.h

d、matrix.h

3、in matlab, the mex command is used to compile the source programs of c .**unit test 10**

1、after the spreadsheet link program is loaded in the excel system, （ ） will be added in the home tab of the excel window.

a、excel command group

b、spreadsheet link command group

c、matlab command group

d、notebook command group

2、when exporting data from excel sheets to the matlab workspace, an array of ( ) type is generated in the matlab workspace.

a、cell

b、double

c、char

d、object

3、open a readable and writable file in ( ).

a、r

b、r

c、a

d、rw

4、the function to determine whether the file pointer reaches the end of the file is ( ).

a、ftell

b、fseek

c、feof

d、ferror

5、after executing the following program, the value of c is ( ).fid=fopen('data.dat','r '); fwrite(fid,eye(5)); fseek(fid,0,-1); b=fread(fid,[5,5]); c=sum(sum(b)) fclose(fid);

a、0

b、1

c、25

d、5

6、in c/c , the statement used to define a pointer to a mat file is ( ).

a、matfile *p;

b、mat *p;

c、file *p;

d、file *p;

7、in c/c , the function used to open the mat file is ( ).

a、fopen

b、matopen

c、mexopen

d、matfileopen

8、which of the following statements are correct about the matlab engine. ( )

a、matlab command can be executed in c/c program with matlab engine.

b、through matlab engine, the efficiency of developing application program can be improved.

c、through matlab engine, you can directly call c/c functions in matlab.

d、the execution efficiency of programs containing matlab engine functions is reduced.

9、when the file is not opened successfully with the fopen function, the function returns -1.

10、the gateway routine of mex source program is used to establish connection between matlab system and the external routines to be called.

11、mex source program can be run directly in matlab.

12、in matlab, you can use mex command to compile c/c source program.**course examination****the final exam**

1、when executing a command in the command window, if you do not want to output the result immediately, you can add ().

a、colon (:)

b、comma (,)

c、semicolon (;)

d、percent (%)

2、after the following command is executed, the value of x is (). >> clear >> 5i; >> x=ans*j

a、5i

b、-5

c、5

d、5i*j

3、the result of the function floor(-2.1) is ().

a、-3

b、-2

c、1

d、2

4、the expression which can make the diagonal elements of matrix a plus 30 is ().

a、a 30*eye(size(a))

b、a 30*eye(a)

c、a 30*ones(size(a))

d、a 30*eye(4)

5、after the statement [x,d]=eig(a) is executed, d is a ().

a、triangular matrix

b、diagonal matrix

c、scalar matrix

d、identity matrix

6、the main purpose of using sparse storage is ().

a、change storage order

b、improve operation precision

c、save memory space

d、design efficient algorithm

7、in the switch statement, the case result list is the value of the switch expression. when there are multiple values, it is indicated by ().

a、structured data

b、numerical data

c、enumerated data

d、cell data

8、look at the following two for loops. the correct option is (). loop 1：for k=[12,3,1,0] … end loop 2：for k=[12;3;1;0] … end

a、loop 1 loops 4 times，loop 2 loops 1 time.

b、loop 1 loops 1 time，loop 2 loops 4 times.

c、loop 1 and loop 2 both loop 4 times.

d、loop 1 and loop 2 both loop 1 time.

9、define a function file fsum.m：function s=fsum(n) if n<=1 s=1; else s=fsum(n-1) n; end the result of calling the fsum function in the command window is (). >> fsum(10

a、45

b、55

c、65

d、75

10、the result of the following program is ().x=[0,1,1,0,0]; y=[0,0,1,1,0]; for n=1:3 plot(n*x,n*y) hold on end axis equal

a、3 rectangles with lower-left corner at the origin

b、3 rectangles with center at origin

c、3 straight lines

d、15 points

11、to make the function y=lnx plotted as a straight line, the plotting function should be ().

a、polar

b、semilogx

c、semilogy

d、loglog

12、after running the following program, the graph you see is ().t=0:pi/6:2*pi; [x,y,z]=cylinder(t, 6); surf(x,y,z) view(0,90); axis equal

a、6 concentric circles

b、6 concentric hexagons

c、12 concentric circles

d、12 concentric hexagons

13、let p be a vector of polynomial coefficients and a be a square matrix, about the values of polyval(p,a) and polyvalm(p,a), ().

a、one is a scalar, another is a square matrix

b、both are scalars

c、the two values are equal

d、the two values are not equal

14、the function usually used for curve fitting is ().

a、the random function

b、the polynomial function

c、the exponential function

d、the trigonometric function

15、when there are errors in the sample data obtained from experiments or tests, the appropriate method to estimate other data is ().

a、data interpolatio

b、curve fittin

c、solve equatio

d、none of the above

16、for a system of linear equations ax = b, when det(a) ≠ 0, the solution of the equation is ().

a、a/b

b、b/a

c、b\a

d、a\b

17、the following function that cannot be used to find the numerical solution of ordinary differential equation is ().

a、ode23

b、ode34

c、ode45

d、ode113

18、find the minimum value of f(x)=x sin(2x-1) around 0, the corresponding command is () .

a、[x,fval]=fminbnd(@(x) x*sin(2*x-1),0,0.5)

b、[x,fval]=fminbnd(@(x) x*sin(2*x-1),0)

c、[x,fval]=fminsearch(@(x) x*sin(2*x-1),[0,0.5])

d、[x,fval]=fminunc(@(x) x*sin(2*x-1),[0,0.5])

19、the value of the function factor(sym(12)) is ().

a、'12'

b、12

c、[3, 4]

d、[ 2, 2, 3]

20、input the following commands in the command window:>> f=sym(1); >> eval(int(f,1,4)) then the output result after command execution is ().

a、3

b、4

c、5

d、1

21、let h be the curve, the command that can be used to set its color to red is ().

a、h.color='r';

b、h.color='r';

c、h.color='r';

d、h.linecolor='r';

22、the property used to define the response to click operation of button is ().

a、string

b、command

c、callback

d、value

23、in order to specify the menu item as gray when defining it, you can set the enable property to ().

a、'on'

b、'off'

c、'yes'

d、'no'

24、customize the parameter setting dialogs and icons for the subsystem so that the subsystem itself has a separate operating interface, which is called the subsystem's ().

a、packaging

b、mask

c、integration

d、combination

25、open a readable and writable file in ().

a、r

b、r

c、a

d、rw

26、if the specified file cannot be opened by using the fopen function, the value which the function returns is ().

a、-1

b、0

c、1

d、2

27、the matlab expression for the following mathematical expression are ().abc (here π and e are all mathematical constants.)

a、pi-exp(pi)

b、pi-power(exp(1),pi)

c、pi-exp(1)^pi

d、pi-e^pi

28、among the following choices, of which two command results are same to each other? ()

a、x=rot90(a) and x=fliplr(a

b、x=(-2:2)' and x=[-2:2]'

c、x=diag(diag(ones(3))) and x=eye(3

d、x=triu(a,1) tril(a,-1) and x=a-diag(diag(a))

29、matrix trace is equal to the sum of the diagonal elements of the matrix. the commands which can figure out matrix trace are ().

a、trace(a)

b、sum(diag(a))

c、prod(eig(a))

d、sum(eig(a))

30、find the value of y. the correct scripts are ().

a、y=2.^(0:20); sum(y)

b、y=2^[0:20]; sum(y)

c、y=1; for k=1:20 y=y 2^k; end y

d、y=[1]; for k=1:20 y=[y, 2^k]; end sum(y)

31、define a function that returns the perimeter and area of a circle according to its radius. the correct options are ().

a、function [p,s]=fcircle(r) p=2*pi*r; s=pi*r*r;

b、function out=fcircle(r) out=[2*pi*r; pi*r*r];

c、fcircle=@(r) [2*pi*r; pi*r*r];

d、[p,s]=@(r) [2*pi*r; pi*r*r];

32、when plotting the sine and cosine curves of [0,2π] simultaneously in a figure window, we can use the command ().

a、x=(0:0.01:2*pi)'; y=[sin(x),cos(x)]; plot(x,y);

b、x=0:0.01:2*pi; y=[sin(x);cos(x)]; plot(x,y);

c、fplot(@(x)sin(x),@(x)cos(x),[0,2*pi]);

d、fplot(@(x)[sin(x),cos(x)],[0,2*pi]);

33、suppose that there are three polynomials, whose coefficient vectors are q, r and s respectively. to work out their products, the following commands that can be used include ().

a、conv(conv(q,r),s)

b、conv(q,conv(r,s))

c、conv(conv(s,r),q)

d、conv(q,r,s)

34、both a and b are vectors of polynomial coefficients, and a=[1,2], b=[3,4,5]. to add the two polynomials, the following incorrect options are ().

a、a b

b、[0,a] b

c、[a,0] b

d、a b(1:2)

35、the following commands () can be used to find the solution to the system of ordinary differential equations.

a、create the function file ty.m.function dy=ty(t, y) dy=[y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)]; call the function file：>> [t, y]=ode45(@ty, [0, 12], [0, 1, 1]); >> plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

b、create the function file ty.m.function dy=ty(t, y) dy=[y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)]; call the function file：>> clear >> [email protected]; >> [t, y]=ode45(h, [0, 12], [0, 1, 1]); >> plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

c、ty=@(t, y) [y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)]; [t, y]=ode45(ty, [0, 12], [0, 1, 1]); plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

d、[t, y]=ode45(@(t, y) [y(2)*y(3); -y(1)*y(3);-0.5*y(1)*y(2)], [0, 12], [0, 1, 1]); plot(t,y(:,1),'-',t,y(:,2),'*',t,y(:,3),' ')

36、the functions that can be used to solve polynomial equations are ().

a、roots()

b、solve()

c、dsolve()

d、diff()

37、when x = 0.1, 0.3, 0.5, 0.7, 0.9, use the following expression to find the value of y = sinx cosx respectively.>> x=0.1:0.2:0.9; >> y=sin(x)*cos(x);

38、the function speye(5) has the same function as the function sparse(eye(5)).

39、the function itself is called in function definition, which is a recursive call of function.

40、when calling the fplot3 function to create a space curve, we need to first calculate the coordinates of the points on the curve.

41、data interpolation can estimate the unknown data in the sampling interval with the known data.

42、the convergence performance of gauss-seidel iterative method is better than jacobi iterative method.

43、the factor() function can be used to determine whether a positive integer is a prime number.

44、building the system simulation model is done in the simulink model edit window.

45、it is possible to convert sawtooth waves into square waves through the triggered subsystem.^{}下一篇 >>^{}

- 2023-01-04 05:48
- 2023-01-04 05:30
- 2023-01-04 04:24
- 2023-01-04 04:01
- 2023-01-04 03:30西餐工艺基础中国大学mooc完整答案

### 最新文章