《matlaba课后习题解答-部分.doc》由会员分享,可在线阅读,更多相关《matlaba课后习题解答-部分.doc(10页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateMATLAB2012a课后习题解答-部分1、请分别用for和while循环语句计算_x0001_的程序。此外,还请写出避免循环的数值、符号计算程序。(习题6.1)请分别用for和while循环语句计算的程序。此外,还请写出避免循环的数值、符号计算程序。(1)用for循环cleartick=1000000;n=0;for m=0:k n=n+0.2m;endn1=nt=
2、tocn1 = 1.250000000000000t = 0.204390640795454(2) 用while循环cleartick=0;n=0;while k1000001 k=k+1; n=n+0.2k;endn1=nt=tocn1 = 1.250000000000000t = 0.202211456170850(3) 符号计算clearticsyms k;f=0.2k;n=symsum(f,k,0,1000000)t=toc(4)数值计算 clear tic k=0:1000000; m=0.2.k; n=m; n1=sum(n) t=tocn1 = 1.2500t = 0.1145-