国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
MATLAB考場 | 試題講評:MATLAB基礎入門篇

【MATLAB基礎入門篇】

1. The default MATLAB variable type for numeric data is:

    A. Single

    B. Double 

    C. Cell

【解析】Double指雙精度型,MATLAB中數值數據的默認類型為double,答案選B。


2. (Select all that apply) Which of the following will create a scatter plot of frogs on the horizontal axis and GDP on the vertical axis, with red markers at the data points?

    A. plot (GDP, frogs, 'ro')

    B. plot (GDP, frogs, 'o', 'r')

    C. plot (frogs, GDP, 'ro') 

    D. plot (frogs, GDP, 'red')

【解析】題目中要求橫軸為frogs, 縱軸為GDP, 數據點加紅色標記。根據plot函數語法,輸入參數依次為橫軸參數,縱軸參數,屬性參數。屬性包括顏色,線型和標記三個特征,所有屬性添加到一個單引號內即可,用MATLAB中規(guī)定符號表示,不限順序?!畆o’代表紅色圓圈標記,答案選C。


3. Given a vector x, what is the command to add 3 to each element, double that value, then sum all the resulting values?

    A. sum (2*x+3)

    B. sum (2*[x(k)+3])

    C. sum [2*x+3]

    D. sum (2*(x+3)) 

【解析】題目中要求向量x每個元素加3,即(x+3);然后計算兩倍的值,即2*(x+3);最后求和,調用sum函數,即sum(2*(x+3));答案選D。


4. (Select all that apply): Given a 2-by-3 matrix A and a 3-by-2 matrix B, which of the following operations are valid?

    A. A + B

    B. A. + B

    C. A * B 

    D. A. * B

【解析】題目中A矩陣維數為2行3列,B矩陣維數為3行2列。根據矩陣運算規(guī)則,矩陣加法(+),點積(. *)運算要求A,B矩陣同維數,所以排除A和D. MATLAB中沒有(.+)運算符, 所以排除B. 矩陣乘法(*)要求A矩陣列數等于B矩陣行數,答案選C。


5. If x is a 20-by-5 table with variables “A”, “B”, “C”, “D”, and “E”, which are all numeric vectors, the command y = x(:,'C') will return:

    A. A 20-by-1 numeric vector

    B. A 20-by-1 table 

    C.A 20-by-5 numeric array

    D. A 1-by-1 table

    E. Anerror message

解析】table是MATLAB中存儲表格數據的一種數據類型,小括號可以實現數組索引, x (:,'C')表示索引變量名為C的列向量,所以維數為20行1列,索引結果依然保持table數據類型。答案選B。


6. Which command renames the first variable in the table t from foo to bar?

    A. t.bar = t.foo

    B. t.VariableNames(1) = 'bar'

    C. t.Properties.VariableNames{1} = 'bar' 

    D. VariableNames(t,1) = 'bar'

析】題目中要求重命名table t的第一個變量,根據MATLAB語法,t.Properties.VariableNames定義變量名屬性,{1}索引第一個變量,然后將新變量名bar賦值即可,答案選C。


7. What construction should you use to loop over a block of code an indefinite number of times?

    A. if

    B. for

    C. switch

    D. while 

    E. Logical indexing

析】if結構實現基于邏輯判斷的條件轉移,switch結構實現有限次數的條件轉移,for結構實現有限次數循環(huán),while結構實現不限次數循環(huán),logical indexing實現條件數據查找,答案選D。


8. Which of the following is a validfunction declaration?

    A. function [x,y] = foo(a,b) 

    B. function foo(a,b) = [x,y]

    C. [x,y] = function foo(a,b)

    D. [x,y] = foo(a,b)

【解析】MATLAB中函數聲明語法如下:

function [out1,out2,...] = function_name(in1,in2,...)

答案選A。

更多問題,微信小編在評論區(qū)等你~

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
[轉載]Matlab中求矩陣行數/列數/維數的函數
★matlab乘與點乘的區(qū)別★ (*與.* ^與.^)【已解決】
Matlab數據類型—多維數組、元胞、字符、文本與結構體
第3章 MATLAB在高等數學中的應用
附錄B Matlab使用方法簡介
【matlab
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服