Matlab练习及答案(最新整理)_第1页
Matlab练习及答案(最新整理)_第2页
Matlab练习及答案(最新整理)_第3页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、matlab 练习一1、一个三位整数各位数字的立方和等于该数本身,则称该数为水仙花数。试编写程序找到并输出全部水仙花数。2、若一个数等于它的各个真因子之和,则称该数为完数,如6=1+2+3,所以6 是完数。求1 500之间的全部完数。3、写一个函数pifun 计算下列级数:f(n)=4*(1-1/3+1/5-1/7+.)并使用tic 和toc 指令来测量pifun(1000000)的计算时间。4、输入一个百分制成绩,要求输出成绩等级为ae,即90100 为a,8089 为b,7079 为c,6069 为d,60 以下为e。5、输入x,y 的值,并将它们的值互换后输出。6、某商场对顾客所购买的商

2、品实行打折销售,标准如下(商品价格用price 来表示): price200 没有折扣;200price500 3%折扣;500price1000 5%折扣; 1000price2500 8%折扣;2500price=90 & a=80 & a=70 & a=60 & a=0 & a60 disp(e); elsedisp(输入数据有误,请核对);end end endendend5x = input(x=);y = input(y=);disp (x,y); t=x;x=y; y=t;disp (x,y);6.x=input(price:) if x200f=x;else if x500f=

3、x*0.97; else if x1000f=x*0.95;else if x2500 f=x*0.92;else if x0.5 ai=i; aj=j; aij=i,jendendend8.sum=0;for m=1:10 i=1;for n=1:mi=i*n;end sumend sum=sum+i;10.a=zeros(1,10); for i=1:10a(i)=input(please enter number);endfor i=1:10if (rem(a(i),7)=0) a(i)breakendendif (i=0&rem(a(i),7)=0) disp(not exist)en

4、d“”“”at the end, xiao bian gives you a passage. minand once said, people who learn to learn are very happy people. in every wonderful life, learning is an eternal theme. as a professional clerical and teaching position, i understand the importance of continuous learning, life is diligent, nothing ca

5、n be gained, only continuous learning can achieve better self. only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. this document is also edited by my studio professionals, ther

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论