- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
测控软件技术基础周鑫
测控软件技术基础
姓名:周鑫
班级:232131
学号:20131000982
指导老师:黄玉金
Basic Syntax and Command-Line Exercises
1. Create a vector of the even whole numbers between 31 and 75.
代码:x=32:2:75
2. Let x = [2 5 1 6].
a. Add 16 to each element
b. Add 3 to just the odd-index elements
c. Compute the square root of each element
d. Compute the square of each element
代码:a=x+16;
b = x(1:2:end) + 3
c = sqrt(x)
d = x.^2
5. Create a vector x with the elements ...
代码:a = 2:2:20
b = 10:-2:-4
c1 = 1:5, c2 = 1./c1 , rats(c2)
d1 = 0:4, d2 = 1:5, d3 = d1./d2 , rats(d3)
6. Create a vector x with the elements,
xn = (-1)n+1/(2n-1)
Add up the elements of the version of this vector that has 100 elements.
代码:n = 1:100;
x = ( (-1).^(n+1) ) ./ (2*n - 1);
y = sum(x)
10. Make a good plot (i.e., a non-choppy plot) of the function
f(x) = sin(1/x)
for 0.01 < x < 0.1. How did you create x so that the plot looked
good?
代码:x=0.01:0.0001:0.1;y=sin(1./x);plot(x,y)
Basic Array Syntax and Manipulations
1. Given x = [3 1 5 7 9 2 6], explain what the following commands "mean" by
by summarizing the net result of the command.
a. x(3)
b. x(1:7)
c. x(1:end)
d. x(1:end-1)
e. x(6:-2:1)
f. x([1 6 2 1 1])
g. sum(x)
答: x(3)表示x行向量中的第三个元素。x(1:7)表示x行向量中第1到7个元素。x(1:end)表示x行向量中第1到最后一个元素。x(1:end-1)表示x行向量中第1到倒数第二个元素。x(6:-2:1)表示x行向量中第6个元素到第1个元素中的偶数项元素。x([1 6 2 1 1]):方括号中表示x行向量中元素的序号,整个表示由这些元素组成的新行向量。sum(x):表示x中所有元素求和。
2. Given the array A = [ 2 4 1 ; 6 7 2 ; 3 5 9], provide the commands needed to
a. assign the first row of A to a vector called x1
b. assign the last 2 rows of A to an array called y
c. compute the sum over the columns of A
d. compute the sum over the rows of A
e. compute the standard error of the mean of each column of A (NB. the standard
error of the mean is defined as the standard deviation divided by the
square root of the number of elem
文档评论(0)