辽宁工程技术大学实验报告程序设计_第1页
辽宁工程技术大学实验报告程序设计_第2页
辽宁工程技术大学实验报告程序设计_第3页
辽宁工程技术大学实验报告程序设计_第4页
辽宁工程技术大学实验报告程序设计_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

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

文档简介

1、x 1,1.已知函数f(x) 1,2 x0 x 1 计算 f ( 1), f(0.5), f (1.5)。1 x 2jj editor -ati_ab7wqrke3tam 1_1 .rnfile edit text celli tools deb des ktop window help。一1目鱼二二7身触t回阻 晅ikfunct lcn out put_args = lint it ledl t input_args j将"untitled 1 stimary of thi§ function 名口片 用 detailed ekplanation gees herefun

2、ction. y=exajil_ 1 (.) if x>=-l<ck k+1 ,elseif宜=口息宜£1尸i ;elseif 置>=1 良缸=21001、用for-end 循环语句求:100!和i。end§ editcr' c; viatla btrkew ml_2 1mf-ib ecit text cell toalf debug desklcp window htp曾触f.周湄1e1234f'jnction outp'jt.sifs = uhtitledl ( irju*_arf5 .auntitledl sunnaey cf

3、. this furictien gone hersx detiesplanation joes herefunrticm :/=eminl_2(ri)'for i-lmcommand window» y=ekamj_2 (100)elbid9. 3326e-157»£ editor - c'1 ma-lab.vuorkexam 1_ 1 ,rnfile edit teed cell toalf 口业吟口骷 ktep wine on he p口:飞.暹3 色四主d© *1 研get ion output.arjs - itrtiusdl

4、: input.m堂 )2 othlei1 sjiuiary of this fimrtimi jots her«3 显 detailed asplanatian goes here<fmcliwi j=e«anl_3 in)-e ;6 -fcr 1=1 ;r.7 - 万尹» 产号hm1_3(1qq)5q512、用while-end 循环语句求不超过1000的偶数之和与奇数之和。q editor - c:iyatlabaw0rkex3ml_l.mfile edit te>4 cell tools osbug desktop wirdow help口彦p

5、 7乜ffi启c s #4 f 栏i1 1 %function outpu+_args = untit ledl ( j_nput_args )2 psuutitleplof this functiongoesher?3 % detail&d explana-tion goes here4 fmigtion y=ekaml_l» y=exajil_ 15 -n=d ;s -y=o.7 -vh.lle nq=gms -nn+2;2505003 -y=y4n;0 -end目 edrtor - cimatlabm 1_2.nfifile edit text cell tools d

6、ebug desktop windonw help的。_ 一4一直二一昌调f.1泡1 function ou+put_args = untitled 1( input_args 2 ssuntitled 1 sumjitary of this funcrtion goes here3 % detailed explanation goes heue4 func+±an y=ekajnl_l5 -口=1;6 -y= ;»y=ezaml_27 -while tl<=q96s -n=n+2;y =9 -y=jr+n;10 - end25l0014、建立一个命令 m-文件:求

7、所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字的立方和等于该数本身。例如,153是一个水仙花数,因为153=13+53+33 0条覆骂-cj u sers xk- 21. d o c u m en tssxaril_l.nn -f-function exami 1-.forn= 100:999jrtl=f ix (tx/103);jft2=rem (f iir cw 10 10):jn3=rin lo):if jn-=nj -3鹏2 - 3+m3”3;di sp (m)153370371end5、建立如下矩阵10end4071(1)m20100 10 1020072000002

8、007300000200740000020075000002007(2)r 器-c:u&er5xk-21document5/器-c: u &er$xk- 2 ldo cumentm at lexamlexjml l.iri- function use ml. 1a=zeros(10);h=ores(10):i=l0:: 10:100:ml=di咤(i);芋 al+tiril®:disp (a)fiinct ion exajiil_2j= 2007, 2007,2007, 2007, 2007;a=diag ;i=20:10:50:adiagtij 1):a2=浒al;

9、drsp t.a21>> *xaml 11000000000012000000qq0i13000000001114000fl000111i50000q011111600000i11l117000011it1i1so001111111190011111i1l100» cxull_e2007zo000czcu ;w0000200:400c00200750c0002007693,输出为396。6、从键盘输入一个数,将它反向输出,例如输入 '-j editor - c:mjatla&7worlcexann 1 _4.mfile edittext cell tool

10、s debug deslcto口 3甚e值s c昌kfunction unlit%uimiledl smmary of this functioutput_args 2345 -6 -7 -8 -9 -% detailed emplanation oes functiotl m二。印肚_4input请输入一个三位数:');>l=fix(jn/100);ni2=reni (f i_x10);m3二reo加,10);m5l+m2*l 口/34 100here»次白第却11_4话输入一个三位机s38836a,7、输入一个百分制成绩,要求输出成绩等级70-79 为 c, 60-

11、69 为 d, 60 以下为 eb, c, d, e其中 90-100 位 a, 80-89 为 b,1)分别用if语句和switch语句实现2)输入百分制成绩后要判断成绩的合理性,对不合理的成绩应输出出错信息。editor - c:'imatla07wc>rcexaml_5.ryfile edit text cell tools debug deskt ¥ ®_ 昌林1 jtfunction out put .args = ihrt;2 untitled i sumnary of this fine13 % dertailed explanation goe

12、s ei4 functinn n=px;in1 _556 -0imutf'i杳输入学生或蒋士 );1 - if n>100|n(o氧- rhsp输入错谭i "9 - elseif n<=100ftn>=9(1 ri -disj)("山:11 - elseif 出9晦nxbq12 -disr(t甲】:13 - elseif n<8d4n>=7014 - disp (' c:);15 - elseif 口奸晦nx6q16 -disrcd?k17 - elseis -rlikpc r'】;19 - endv ed iter -

13、 c. mat la 57 v<o rkexa m 1_,6 mfikedit 'ext cel tools debug def方荒噜s cs i1234ssfunction oulput_ args j = ui %unritledl sumnary of this fur % detailed explanatiem goes i furiction n=eitaiil_0b 6 7 83 iq 11 12 13 14 15 id 17 18 19 20-xmput ('请输入学生成虢-ewltch fix (n/p10)-case 9-disp ('2');-c b-dispb'),-case i?l-disp(tct)h-case -disp,-case 1a 1, if 3, 4, 5-di 叩('e'),othcr*iao-输入错误-endi: 3;! r>> n=exanl_5涛输入竽生成绩:98a>> n=examl_5 请输入学生成鹫:s7b>> n=exaj(il_s请输入学生成维士 94)>rt= ekamls请输入学生成筹:36e>n=bkam.l_6请输入学生限娥=">>

温馨提示

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

评论

0/150

提交评论