ImageVerifierCode 换一换
格式:DOCX , 页数:8 ,大小:15.59KB ,
资源ID:1282397      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/1282397.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(matlab选择结构程序设计.docx)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

matlab选择结构程序设计.docx

1、matlab选择结构程序设计实验三 选择结构程序设计一、实验目的1、掌握建立和执行M文件的方法。2、掌握利用if语句实现选择结构的方法。3、掌握利用switch语句实现多分支选择结构的方法。4、掌握try语句的使用。二、实验内容1、求分段函数的值。用if语句实现,分别输出x=-5.0,3.0,1.0,2.0,2.5,3.0,5.0时的y值。x=input(please input the value of x);if x=0&x aaaaaplease input the value of x-3.0y = 11 aaaaaplease input the value of x1.0y = 2

2、 aaaaaplease input the value of x2.0y = 1 aaaaaplease input the value of x2.5y = -0.2500 aaaaaplease input the value of x3.0y = 5 aaaaaplease input the value of x5.0y = 192、输入一个百分制成绩,要求输出成绩等级A、B、C、D、E。其中90分100分为A,80分89分为B,70分79分为C,6069分为D,60分以下为E。要求:(1)分别用if语句和switch语句实现。(2)输入百分制成绩后要判断该成绩的合理性,对不合理性的

3、成绩应输出出错信息。If语句s=input(please input the score:);if s=90&s=80&s=70&s=60&s0&s bbbplease input the score:94rank =A bbbplease input the score:75rank =C bbbplease input the score:-3rank =wrong socre bbbplease input the score:456rank =wrong socreSwitch语句score=input(please input the score:);switch floor(sco

4、re/10) case9,10 rank=A; case8 rank=B; case7 rank=C; case6 rank=D; case num2cell(0:5) rank=E; otherwise rank=wrong score;endrank=rank cccplease input the score:-3rank =wrong score cccplease input the score:456rank =wrong score cccplease input the score:94rank =A cccplease input the score:45rank =E3、硅

5、谷公司员工的工资计算方法如下:(1)、工作时数超过120小时者,超过部分加发15%。(2)、工作时数低于60小时者,扣发700元。(3)、其余按每小时84元计发。试编程按输入的工号和该号员工的工时数,计算应发工资。number=input(please input work number:);h=input(please input work hours:);if h120 wage=120*84+(h-120)*84*1.15;elseif h dddplease input work number:01please input work hours:74wage = 6216 dddple

6、ase input work number:02please input work hours:53wage = 3752 dddplease input work number:03please input work hours:135wage = 115294、设计程序,完成两位数的加、减、乘、除四则运算,即产生两个两位随机整数,再输入一个运算符号,做相应的运算,并显示相应的结果。x=input(please input a sign:,s);x1=round(rand(1)*90+10);x2=round(rand(1)*90+10);if x=+ answer=x1+x2;elseif

7、 x=- answer=x1-x2;elseif x=* answer=x1*x2;elseif x=/ answer=x1/x2;endx1x2answer eeeplease input a sign:+x1 = 83x2 = 11answer = 94 eeeplease input a sign:-x1 = 23x2 = 28answer = -55、建立56矩阵,要求输出矩阵第n行元素。当n值超过矩阵的行数时,自动转为输出矩阵的最后一行元素,并给出出错信息。x=rand(5,6);n=input(please input n:);if n0&n5; y=x(5,:); disp(wrong n);elseif n eeeplease input n:4y = 0.9383 0.2789 0.4787 0.9222 0.9238 0.5945 eeeplease input n:7wrong ny = 0.4397 0.1121 0.9442 0.5744 0.1443 0.3099 eeeplease input n:-3y =wrong n

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1