资源描述:
《MATLAB数学实验答案+(胡良剑+着)+高等教育出版》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、file:///C
2、/DocumentsandSettings/Administrator/桌面/ch1.txt%Page20,ex1(5)等于[exp(1),exp(2);exp(3),exp(4)](7)3=1*3,8=2*4(8)a为各列最小值,b为最小值所在的行号(10)1>=4,false,2>=3,false,3>=2,ture,4>=1,ture(11)答案表明:编址第2元素满足不等式(30>=20)和编址第4元素满足不等式(40>=10)(12)答案表明:编址第2行第1列元素满足不等式(30>=20)和编址第2行第2列元素满足不等式(40>=1
3、0)%Page20,ex2(1)a,b,c的值尽管都是1,但数据类型分别为数值,字符,逻辑,注意a与c相等,但他们不等于b(2)double(fun)输出的分别是字符a,b,s,(,x,)的ASCII码%Page20,ex3>>r=2;p=0.5;n=12;>>T=log(r)/n/log(1+0.01*p)T=11.5813%Page20,ex4>>x=-2:0.05:2;f=x.^4-2.^x;>>[fmin,min_index]=min(f)fmin=-1.3907%最小值min_index=54%最小值点编址>>x(min_index)ans=0.65
4、00%最小值点>>[f1,x1_index]=min(abs(f))%求近似根--绝对值最小的点f1=0.0328x1_index=24>>x(x1_index)ans=-0.8500>>x(x1_index)=[];f=x.^4-2.^x;%删去绝对值最小的点以求函数绝对值次小的点>>[f2,x2_index]=min(abs(f))%求另一近似根--函数绝对值次小的点f2=0.0630x2_index=65file:///C
5、/DocumentsandSettings/Administrator/桌面/ch1.txt(第1/3页)[2010-3-2419:
6、39:31]file:///C
7、/DocumentsandSettings/Administrator/桌面/ch1.txt>>x(x2_index)ans=1.2500%Page20,ex5>>z=magic(10)z=9299181567745158409880714167355576441481882022545663704785871921360626971288693252961687552341724768390424926336523582899148303239667961395972931384572101294967835374446531
8、11810077843643502759>>sum(z)ans=505505505505505505505505505505>>sum(diag(z))ans=505>>z(:,2)/sqrt(3)ans=57.157746.188046.765450.229553.693613.85642.88683.46416.928210.3923>>z(8,:)=z(8,:)+z(3,:)z=92991815677451584098807141673555764414818820225456637047858719213606269712886932529616875
9、5234172476839042492633652358289914830323966file:///C
10、/DocumentsandSettings/Administrator/桌面/ch1.txt(第2/3页)[2010-3-2419:39:31]file:///C
11、/DocumentsandSettings/Administrator/桌面/ch1.txt8387101115119838710111511910129496783537444653111810077843643502759file:///C
12、/DocumentsandSettings/Adm
13、inistrator/桌面/ch1.txt(第3/3页)[2010-3-2419:39:31]file:///C
14、/DocumentsandSettings/Administrator/桌面/ch2.txt%Page40ex1先在编辑器窗口写下列M函数,保存为eg2_1.mfunction[xbar,s]=ex2_1(x)n=length(x);xbar=sum(x)/n;s=sqrt((sum(x.^2)-n*xbar^2)/(n-1));例如>>x=[81706551766690876177];>>[xbar,s]=ex2_1(x)xbar=72.4000
15、s=12.1124%Page40ex2