版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
1、實驗一:t1:%第一小題z1=2*sin(85*pi/180)/(1+exp(2)%第二小題x=2,1+2i;-0.45,5;z2=1/2*log(x+sqrt(1+x.2);z2%第三小題a=-3.0:0.1:3.0;z3=1/2*(exp(0.3*a)-exp(-0.3*a).*sin(a+0.3)+log(0.3+a)/2)%第四題t=0:0.5:2.5z4=(t=0&t=1&t=2&t=a&ab disp(帕薩卡矩陣p性能更好);elseif ab disp(希爾伯特矩陣h性能更好);else disp(兩個矩陣性能相同);endt3:a=1:25;a=reshape(a,5,5)di
2、sp(行列式的值:);disp(det(a);disp(矩陣的秩:);disp(rank(a);disp(矩陣的跡:);disp(trace(a);disp(矩陣的范數(shù):);disp(norm(a);t4:a=-29,6,18;20,5,12;-8,8,5v,d=eig(a)t5:a=1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6b=0.95,0.67,0.52x1=abb(3)=0.53x2=abdisp(系數(shù)矩陣a的條件數(shù):);disp(cond(a);t6:a=1:25;a=reshape(a,5,5)disp(b1=sqrtm(a);b1=sqrtm(a)dis
3、p(b2=sqrt(a);b2=sqrt(a)disp(b1*b1);b1*b1disp(b2.*b2);b2.*b2實驗三:t1:x=-5.0:2:5.0for i=1:length(x); if (x(i)=0)&(x(i)5)&(x(i)=2)&(x(i)=3); y(i)=x(i)2-5*x(i)+6; else y(i)=x(i)2-x(i)-1; endendyt2-if:s=input(please enter the score:);while (s100) disp(the score is not reasonable); s=input(please enter the
4、score:);endif (s=90&s=80&s=70&s=60&s70); disp(d);else disp(e);endt2-switch:s=input(please enter the score:);while (s100) disp(the score is not reasonable); s=input(please enter the score:);endswitch fix(s/10)case9,10disp(a);case8disp(b);case7disp(c);case6disp(d);case0,1,2,3,4,5disp(e);endt3:t=input(
5、請輸入工時time=);if t120 w=120*84+(t-120)*1.15*84;elseif t60 w=t*84-700;else w=84*t;enddisp(應發(fā)工資為:);disp(w);t4:a=10+floor(rand(1)*89)b=10+floor(rand(1)*89)s=input(請輸入+或-或*或/,s);while(s=+&s=-&s=*&s=/) disp(輸入的符號錯誤,請重新輸入); s=input(請輸入+或-或*或/,s);endswitch s case+ c=a+b; case- c=a-b; case* c=a*b; case/ c=a/b
6、; endct5:a=rand(5,6)n=input(請輸入n:);while (n5 b=a(5,:)else b=a(n,:)end實驗四:t1:n=input(請輸入n:);m=0;for i=1:n; m=m+1/i2;endpii=sqrt(6*m)t1-2:n=input(請輸入n:);m=1./(1:n).2;s=sum(m);pii=sqrt(6*s)t2:n=1000;y=0;for i=1:n; y=y+1/(2*i-1); if y=3 disp(最大n值為:); i-1 disp(對應的y值為:); y-1/(2*i-1) break; endendt3:format
7、 longa=input(請輸入a:);b=input(請輸入b:);x(1)=a/(1.0+b);i=1;x(2)=a/(x(i)+b);while (abs(x(i+1)-x(i)0.00001&i500) i=i+1; x(i+1)=a/(x(i)+b);endr1=(-b+sqrt(b2+4*a)/2;r2=(-b-sqrt(b2+4*a)/2;disp(x,num2str(i+1),=,num2str(x(i+1),8);disp(x,num2str(i),=,num2str(x(i),8);disp(r1=,num2str(r1,8),r2=,num2str(r2,8);forma
8、t shortt4:f(1)=1;f(2)=0;f(3)=1;i=4;while(i0)fn=length(find(f0)f0=length(find(f=0)t5:j=0;s=0;for i=3:50 m=i*(i-1)-1; if isprime(m)=1 m s=s+m; j=j+1; endenddisp(親密數(shù)的對數(shù):,num2str(j);disp(所有親密素數(shù)之和:,num2str(s);實驗五:fn1:function f=fn1(n)f=n+10*log(n.2+5);fn2:function f=fn2(n)f=0;for i=1:n f=f+i*(i+1);endfx:
9、function f=fx(x)f=1./(x-2).2+0.1)+1./(x-3).4+0.01);t1:x=input(請輸入一個復數(shù):);fe=exp(x)flg=log(x)fsin=sin(x)fcos=cos(x)t2:m1=input(請輸入m1:);m2=input(請輸入m2:);t=input(請輸入theta:);a=m1*cos(t),-m1,-sin(t),0;m1*sin(t),0,. cos(t),0;0,m2,-sin(t),0;0,0,-cos(t),1b=0,m1*9.8,0,m2*9.8disp(a1,a2,n1,n2=);disp(ab);t3:j=1;
10、n=1;k=1;for i=10:99 % 挑選出1099中所有的素數(shù) if isprime(i)=1 m(j)=i; j=j+1; endendfor t=1:length(m); s(n)=10*rem(m(t),10)+fix(m(t)/10); %挑選出的素數(shù)進行位置交換 if isprime(s(n)=1 %再挑選出交換絕對素數(shù) r(k)=m(t); k=k+1; end n=n+1;enddisp(所有兩位絕對素數(shù):,num2str(r)t5:y1=fn1(40)/(fn1(30)+fn1(20) %函數(shù)調(diào)用y2=fn2(40)/(fn2(30)+fn2(20)實驗六:t1:x=l
11、inspace(0,2*pi,101);y=(0.5+3*sin(x)./(1+x.2).*cos(x);plot(x,y);t2:x=linspace(0,2*pi,100);y1=x.2;y2=cos(2*x);y3=y1.*y2;subplot(2,2,1);plot(x,y1,r:,x,y2,y-,x,y3,b-.);subplot(2,2,2);plot(x,y1,r:);subplot(2,2,3);plot(x,y2,y-);subplot(2,2,4);plot(x,y3,b-.);t2-3:x=linspace(0,2*pi,10);y1=x.2;y2=cos(2*x);y3
12、=y1.*y2;subplot(3,4,1);bar(x,y1,r);axis(0,7,0,40);subplot(3,4,2);stairs(x,y1,y);axis(0,7,0,40);subplot(3,4,3);stem(x,y1,b);axis(0,7,0,40);subplot(3,4,4);fill(x,y1,g);axis(0,7,0,40);subplot(3,4,5);bar(x,y2,r);axis(-1,7,-1,1);subplot(3,4,6);stairs(x,y2,y);axis(-1,7,-1,1);subplot(3,4,7);stem(x,y2,b);ax
13、is(-1,7,-1,1);subplot(3,4,8);fill(x,y2,g);axis(-1,7,-1,1);subplot(3,4,9);bar(x,y3,r);axis(0,7,-30,50);subplot(3,4,10);stairs(x,y3,y);axis(0,7,-30,50);subplot(3,4,11);stem(x,y3,b);axis(0,7,-30,50);subplot(3,4,12);fill(x,y3,g);axis(0,7,-30,50);t3:x=linspace(-5,5,100);y=;for x0=x; if x0=0; y=y,(x0+sqrt
14、(pi)/exp(2); else y=y,1/2*log(x0+sqrt(1+x02); endendsubplot(1,2,1);plot(x,y);for i=1:length(x) if x(i)0.5);b=length(k);disp(大于0.5的隨機數(shù)個數(shù)占總數(shù)的百分比:);sprintf(%f%, b/300)t2:p=45+50*rand(100,5)disp(最高分及序號:);y,u=max(p,1)disp(最低分及序號:);y1,u1=min(p,1)disp(每門課平均分:);mean(p,1)disp(每門課的標準方差:);std(p,0,1)s=sum(p,2);
15、disp(總分最高分:);y2,u2=max(s,1)disp(總分最低分:);y3,u3=min(s,1)zcj,xsxh=sort(s,1,descend) %descend降序t3:h=6:2:18;t1=18.0,20.0,22.0,25.0,30.0,28.0,24.0;t2=15.0,19.0,24.0,28.0,34.0,32.0,30.0;t=6.5:2:17.5;t1=interp1(h,t1,t,spline)t2=interp1(h,t2,t,spline)t4:x=1:10:101;y=log10(x);p=polyfit(x,y,5)x1=1:0.01:101;y1=
16、log10(x1);y2=polyval(p,x1);plot(x1,y1,r-,x1,y2,b-.);t5:p1=1,2,4,0,5;p2=0,0,0,1,2;p3=0,0,1,2,3;p4=conv(p2,p3);sp1=length(p1);sp2=length(p4);p=zeros(1,sp2-sp1),p1+p4x=roots(p)a=-1,1.2,-1.4;0.75,2,3.5;0,5,2.5;ax=polyval(p,a)aa=polyvalm(p,a)實驗九:t1:f=inline(det(x x2 x3;1 2*x 3*x2;0 2 6*x);i=1;x=1;while x
17、=3.01 g(i)=f(x); i=i+1; x=x+0.01;enddx=diff(g)/0.01;dx(1)dx(101)dx(length(g)-1)t2:f1=inline(sqrt(cos(t.2)+4*sin(2*t).2+1)f2=inline(log(1+x)./(1+x.2)i1=quad(f1,0,2*pi)i2=quad(f2,0,2*pi)t3:a=6,5,-2,5;9,-1,4,-1;3,4,2,-2;3,-9,0,2;b=-4,13,1,11;x1=abl,u=lu(a);x2=u(lb)q,r=qr(a);x3=r(qb)fun:function f=fun(x
18、);x=x(1);y=x(2);z=x(3);f(1)=sin(x)+y2+log(z)-7;f(2)=3*x+2y-z3+1;f(3)=x+y+z-5;t5:f=inline(3*x+sin(x)-exp(x);fzero(f,1.5)x=fsolve(fun,1 1 1,optimset(display,off)實驗十:t1:x=sym(6);y=sym(5);z=(x+1)/(sqrt(3+x)-sqrt(y)t2:syms x y; t=sym(5135);factor(x4-y4)factor(t)t3:syms beta1 beta2 x;simplify(sin(beta1)*c
19、os(beta2)-cos(beta1)*sin(beta2)simplify(4*x2+8*x+3)/(2*x+1)t4:syms a b c d e f g h k;p1=0,1,0;1,0,0;0,0,1;p2=1,0,0;0,1,0;1,0,1;a=a,b,c;d,e,f;g,h,k;b=p1*p2*ab1=inv(b)b1*b;tril(b)det(b)t5:syms x t a y f1=(x*(exp(sin(x)+1)-2*(exp(tan(x)-1)/sin(x)3;limit(f1,x,0) %(1)f2=(sqrt(pi)-sqrt(acos(x)/sqrt(x+1);limit(f2,x,-1,right) %(2)f3=(1-cos(2*x)/x;diff(f3,x,1) %(3)diff(f3,x,2)a=ax,t3;t*cos(x),log(x);diff(a,x,1) &(4)diff(a,t,2)diff(diff(a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度全國區(qū)域銷售合作協(xié)議書
- 2025年度舞蹈編導與教學團隊合作協(xié)議
- 二零二五年度電子商務平臺試用期勞動合同文本
- 水草船打撈施工方案
- 順義石油瀝青道路施工方案
- 景觀涼亭施工方案
- 二零二五年度煤炭開采企業(yè)安全生產(chǎn)責任保險合同3篇
- 數(shù)字化背景下的空間極化-深度研究
- 農(nóng)業(yè)供應鏈優(yōu)化模式-深度研究
- 醫(yī)療大數(shù)據(jù)集成平臺-深度研究
- 2024年秋季學期學校辦公室工作總結(jié)
- 鋪大棚膜合同模板
- 長亭送別完整版本
- 2024年英語高考全國各地完形填空試題及解析
- 智能養(yǎng)老院視頻監(jiān)控技術方案
- 你比我猜題庫課件
- 無人駕駛航空器安全操作理論復習測試附答案
- 建筑工地春節(jié)留守人員安全技術交底
- 默納克-NICE1000技術交流-V1.0
- 蝴蝶蘭的簡介
- 老年人心理健康量表(含評分)
評論
0/150
提交評論