云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > MATLAB期末考试试卷及其参考答案

MATLAB期末考试试卷及其参考答案

  • 62 次阅读
  • 3 次下载
  • 2025/5/6 21:56:41

y=e(-t/3)

y0=e(-t/3)*sin(3t)

其中y是用红色的细实线,而y0是用兰色的虚线绘制,t的区间是(0:4?), t的步长为?/50,t轴和y轴分别用斜粗题指示,图中有网格表示。 四、编程题 1、答案 clf

x=0:pi/200:2*pi; y1=sin(x); y2=cos(x);

zz=x(find(abs(y1-y2)<0.005)) z=min(zz)

plot(x,y1,'r-',x,y2,'g-.') hold on

plot(zz,sin(zz),'*') legend('sin','cos') 2、答案

t=(0:pi/100:pi)'; y1=sin(t)*[1,-1]; y2=sin(t).*sin(9*t); t3=pi*(0:9)/9;

y3=sin(t3).*sin(9*t3);subplot(1,2,1) plot(t,y1,'r:',t,y2,'b',t3,y3,'bo') subplot(1,2,2)

plot(t,y2,'b') axis([0,pi,-1,1]) 3、答案

price=input('请输入商品价格'); switch fix(price/100) case {0,1} %价格小于200 rate=0;

case {2,3,4} %价格大于等于200但小于500 rate=3/100; case num2cell(5:9) %价格大于等于500但小于1000 rate=5/100; case num2cell(10:24) %价格大于等于1000但小于2500 rate=8/100;

case num2cell(25:49) %价格大于等于2500但小于5000 rate=10/100;

otherwise %价格大于等于5000 rate=14/100; end

price=price*(1-rate) %输出商品实际销售价格 4、答案

function f=fab(n) if (n==1) f = 1; elseif (n==2) f =2; else

f = fab(n-1) + fab(n-2); end 5、答案 str1 = ''; str2 = ''; str3= ''; val = cell(5,2) a=zeros(5,1); ave = 0;

student = struct('Name',str1,'No',str2,'Scores',val,'Ave',ave); n = input('please input students number:'); fori=1 : n

str1 = input('Name:'); str2 = input('No.:'); %for k=1:2

% val(k,:) = input('Curriculums and Scores:'); % a(k,1)=val{k,2}; %end

%val(1,:) = input('Curriculum:'); %val(:,2) = input('Scores:');

val = input('please input five Curriculums and Scores:'); for k=1:5 a(k,1)=val{k,2}; end

student(i).Name = str1;

student(i).No = str2; student(i).Scores = val; student(i).Ave = mean(a); end

for ii= 1:(length(student)-1) iptr = ii;

forjj=ii+1 : length(student)

if (student(jj).Ave > student(iptr).Ave) iptr = jj; end end

if ii ~=iptr temp = student(ii); student(ii) =student(iptr); student(iptr) = temp; end end

for ii=1 : length(student) if student(ii).Ave > 80 disp(student(ii).Name); disp(student(ii).Ave); end end

disp(['student name',blanks(6),'student no.',blanks(6),'student average']);disp(' ') for ii=1 : length(student)

disp([student(ii).Name,blanks(20),student(ii).No,blanks(20),num2str(student(ii).Ave)]); end

搜索更多关于: MATLAB期末考试试卷及其参考答案 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

y=e(-t/3) y0=e(-t/3)*sin(3t) 其中y是用红色的细实线,而y0是用兰色的虚线绘制,t的区间是(0:4?), t的步长为?/50,t轴和y轴分别用斜粗题指示,图中有网格表示。 四、编程题 1、答案 clf x=0:pi/200:2*pi; y1=sin(x); y2=cos(x); zz=x(find(abs(y1-y2)<0.005)) z=min(zz) plot(x,y1,'r-',x,y2,'g-.') hold on plot(zz,sin(zz),'*') legend('sin','cos') 2、答案 t=(0:pi/100:pi)'; y1=sin(t)*[1,-1]; y2=sin(t).*sin(9*t); t3=pi*(0:9)/9;

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com