正在加载图片...
Final Examination of Tongji University (A) b= a(b The First Semester(2013---2014) a(b)=_ a啡 a(b)=).02= length((b])= Paper-making Teacher:CHEN Ming Audit Teacher:Hans WIEDMANN 9.Assume that array'array'is defined as shown,ad determine the neof the following suby Course Number:_ Course Name:Matlab programming for Mechanical Design arrayl= Time:120minutes Maximum Marks:100 1amay12,3= Grade 一Mpr Number Name Marks 2aray12:4,【1330= I.Fill in the blanks.(50X1') 3到aray111l34gr= 1.MATLAB variable namescan contin ay combination of letters 、and and must begin with 10.Suppose that a=[1 ;34]and b=3;2-1]. If you typeab in the command window,then can get: 2.If you type MATLAB will display alist of possible help topics in the Command Window. If you type ab in the command window,then can get 3.You can type to ist all the variables in the current workspae,together with information about thersie 11.Determine the contentsof arrayafter the following statementsare exeuted. bytes,cass,etc. 1a=23:4578外aB1=a13乳 4.Suppose that you were looking for a function to take the inverse of a matrix,You will use the function:_ a= Suppose that you were going toclear the information in command window,You wll use the function: 211=123:456789外a121月=a33乳1 Suppose that you were going to cear the variables in the workspace,You will use the function: a=_ 5.x=zeros(2) y=ones(six) y=_ 3引a=123:456789外a=a11. z=one0,3到 1- t=zeros(length()t=_ a= 4a=123:456789啡a2end,2:cnd=2 a= then use MATLAB linspoce to generate this vector: 7.Write the results of the following MATLAB statements 12.Determine the sbsrip of thea m=1n=mm A=[](Waring:for example,A(1)=4 and you should use only one subscript! n= A()=5; 2a=ee3,3h:b=123a2=b 26,,14101:829:75刃:86:2=6254124:152 a- 6=12. 13. sta 3eros(1,3)ones3,1r13 the loop; ans=_ tatement terminates the current pass through the loop and returns control to the top of the loop. 8.Suppose that a=[123;456;789 and b=a>S. 14.Assume that value has been initialized to 5.6443,and determine what is printed out by eath of the following 1 Final Examination of Tongji University(A) The First Semester (2013 --- 2014) Paper-making Teacher: CHEN Ming Audit Teacher: Hans WIEDMANN Course Number: Course Name: Matlab programming for Mechanical Design Time: 120 minutes Maximum Marks: 100 Grade Major Number Name Marks Ⅰ. Fill in the blanks. (50×1’) 1. MATLAB variable names can contain any combination of letters, and , and must begin with a . 2. If you type , MATLAB will display a list of possible help topics in the Command Window. 3. You can type to list all the variables in the current workspace, together with information about their size, bytes, class, etc. 4. Suppose that you were looking for a function to take the inverse of a matrix, You will use the function: ; Suppose that you were going to clear the information in command window, You will use the function: ; Suppose that you were going to clear the variables in the workspace, You will use the function: . 5. x = zeros(2) x = ; y = ones(size(x)) y = ; z = ones(2,3) z = ; t = zeros( length(z) ) t = . 6. Use MATLAB operator ':' to generate the vector of [ 𝜋 100 , 2𝜋 100 , 3𝜋 100 , …, 𝜋]: ; then use MATLAB linspace to generate this vector: . 7. Write the results of the following MATLAB statements. 1) m = 7:11; n = [m’ m’] n = ___ ; 2) a = eye(3,3); b = [1 2 3]; a(2,:) = b; a = _ _; 3) [zeros(1,3) ones(3,1)’ 1:3’] ans = _ . 8. Suppose that a = [ 1 2 3; 4 5 6; 7 8 9 ] and b = a > 5. b = ; a(b)= ; a(~b) = ; a(~~b)= ; a(~b) = a(~b).^2= ; length(a(b))= . 9. Assume that array 'array1' is defined as shown, and determine the contents of the following sub-arrays. array1 = [ 1.2 −3.5 4.1 −2.7 0.3 8.1 −7.6 1.8 3.1 0.7 0.5 0.4 1.4 5.7 0.2 1.0 ] 1) array1(2, :) = ; 2) array1(2:4, [1 3 3]) = ; 3) array1([1 1], [3 4])’ = . 10. Suppose that a = [1 2; 3 4] and b = [-1 3; 2 -1]. If you type a .* b in the command window, then can get: ; If you type a * b in the command window, then can get: . 11. Determine the contents of array ‘a’ after the following statements are executed. 1) a = [1 2 3; 4 5 6; 7 8 9]; a([3 1], :) = a([1 3], :) a = ; 2) a = [1 2 3; 4 5 6; 7 8 9]; a([1 2], :) = a([3 3], :) a = ; 3) a = [1 2 3; 4 5 6; 7 8 9]; a = a([1 1], :) a = ; 4) a = [1 2 3; 4 5 6; 7 8 9]; a(2:end, 2:end) = -2 a = . 12. Determine the subscript of the array. 1) A = [4 10 1; 8 2 9; 7 5 6] (Warning: for example, A(1) = 4 and you should use only one subscript!) A( ) = 5; 2) B(:, :, 1)=[4 10 1; 8 2 9; 7 5 7] ; B(:, :, 2)=[6 2 5; 4 12 4; 1 5 2] B( ) = 12. 13. statement terminates the execution of a loop and passes the control to the next statement after the end of the loop; statement terminates the current pass through the loop and returns control to the top of the loop. 14. Assume that value has been initialized to 5.6443, and determine what is printed out by each of the following
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有