MATLAB程序及其应用_2015-2016_试卷(参考答案)

上传人:飞*** 文档编号:44283783 上传时间:2018-06-09 格式:DOC 页数:3 大小:181.50KB
返回 下载 相关 举报
MATLAB程序及其应用_2015-2016_试卷(参考答案)_第1页
第1页 / 共3页
MATLAB程序及其应用_2015-2016_试卷(参考答案)_第2页
第2页 / 共3页
MATLAB程序及其应用_2015-2016_试卷(参考答案)_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《MATLAB程序及其应用_2015-2016_试卷(参考答案)》由会员分享,可在线阅读,更多相关《MATLAB程序及其应用_2015-2016_试卷(参考答案)(3页珍藏版)》请在金锄头文库上搜索。

1、12015 2016 学年第 1 学期 2013 级通信工程专业Matlab 语言及应用(课程)试卷试卷来源:自拟 送卷人:孙云山 田菊花 打印:孙云山 校对:孙云山题目一二三四五总成绩得分阅卷一、 Assume that a, b, c, and d are defined as follows, and calculate the results of the following operations.(10 分) 1221a 2112b 1101c(1) a+b (2) a*b (3) a.*c (4) a./c (5) a/bAnswer:(1)a+b = (2)a*b= 3111 4

2、350(3) a.*c= (4) a./c= 1201 121Inf(5) a/b=或 016 . 08 . 00153 54二、 Assume that a,b,c and d are as defined, and evaluate the following expressions.a=1; ; (10 分) 1021b 0310c 1012d(1)(ac | bc (3)c=d (4)ab y1=1+sin(x);y2=sin(x); plot(x,y1,x,y2) grid on xlabel(independent variable X) ylabel(Dependent Vari

3、able Y1 case 2,4,6,8,10,12,14, disp(The value is even.); otherwisedisp(The value is out of range.) end 六、 Read the following program, and write the result. (10 分)function out=sample(a,b) fprintf( In sample: a=%f, b=%f %f%fn,a,b); a=b(2)+2*a; b=a.*b; out=a+b(1); fprintf( In sample: a=%f, b=%f %f%fn,a

4、,b); / %主程序 a=1;b=3 2 5; fprintf(Before sample: a=%f,b=%f %f%f n,a,b); out=sample(a,b); fprintf(After sample: a=%f,b=%f %f%f n,a,b); fprintf(After sample: out=%fn,out)Answer: Before sample: a=1, b=3 2 5 (2 分)In sample: a=1, b=3 2 5 (2 分)In sample: a=4, b=12 8 20 (2 分)After sample: a=1, b=3 2 5 (2 分)

5、After sample: out=16 (2 分)七、 Read and change the executing program to the logical array and vectorization form. (10 分) a=11 8 7;2 5 14;3 21 1; for ii=1:size(a,1)for jj=1:size(a,2)if a(ii,jj)103a(ii,jj)= a(ii,jj)2;elsea(ii,jj)= sqrt(a(ii,jj);endendend Answer: a=11 8 7;2 5 14;3 21 1; (2 分) b=a10; (2 分

6、)a(b)= a(b).2; (3 分) a(b)= sqrt(a(b) (3 分)注:仅写对结果给 2 分八、 Write a program with for or while loop to calculate . 20152515151 511LLisum(10 分)Answer:sum=0;sign=-1i=1;while i=2016sum=sum+ (sign.(i-1).*(1./(5.(i-1);i=i+1;end或 sum=0;sign=-1for i=1:2016sum=sum+ (sign.(i-1)).*(1./(5.(i-1));end注:程序满分 10 分,语句运

7、用不当,酌情扣分,仅写出正确的 forend 或 whileend结构给 2 分。九、 Simply explain Top-Down Design Technology (10 分)Answer: The concept of top-down design is the basis of our formal program design process. We will now introduce the details of the process.(1) Clearly state the problem that you are trying to solve. (2 分)(2) Define the inputs required by the program and the output to be produced by the program. (2 分)(3) Design the algorithm that you intend to implement in the problem. (2 分)(4) Turn the algorithm into MATLAB statements. (2 分)(5) Test the resulting of MATLAB program. (2 分)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号