




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、word 1 / 19 第二章3. 設(shè)矩陣 a為a=24 23 9 21 6;65 74 24 11 21;34 5 98 75 21;8 42 42 53 121;43 21 45 64 21; (1) b=a(2:5,1:2:5) b = 65 24 21 34 98 21 8 42 121 43 45 21 2a(7)= a = 24 65 34 8 43 23 5 42 21 9 24 98 42 45 21 11 75 53 64 6 21 21 121 21 3a+30 4size(a);ndims(a) 5題目有誤6reshape(x,3,4) 7abs(x) 8char(x)
2、4. l1 = 0 0 0 0 1 0 0 0 0 l2 = 1 1 1 1 1 0 0 0 0 l3 = 0 0 0 1 1 1 0 0 0 l4 = 4 5 6 5. (1)b=a(1:3,:) c=a(:,1:2) d=a(2:4,3:4) e=b*c b = 23.0000 10.0000 -0.7780 0 c = d = word 2 / 19 e = 1.0e+003 * (2)e=10&a25) ans = 1 5 6.all(a) ans = 0 any(a) ans = 1 isnan(a) ans = 0 1 0 0 0 0 0 isinf(a) word 3 /
3、 19 ans = 0 0 1 1 0 0 0 isfinite(a) ans = 1 0 0 0 1 1 1 7. a(1).x1= 學(xué)號 ;a(1).x2= 某某 ;a(1).x3= 專業(yè) ;a(1).x4.x41=成績1; . a(2).x1= 學(xué)號 ;a(2).x2= 某某 ;a(2).x3= 專業(yè) ;a(2).x4.x41=成績1; . a(3).x1= 學(xué)號 ;a(3).x2= 某某 ;a(3).x3= 專業(yè) ;a(3).x4.x41=成績1; . a(4).x1= 學(xué)號 ;a(4).x2= 某某 ;a(4).x3= 專業(yè) ;a(4).x4.x41=成績1; . a(5).x1=
4、學(xué)號 ;a(5).x2= 某某 ;a(5).x3= 專業(yè) ;a(5).x4.x41=成績1; . 8. (1) size(b) ans = 2 2 ndims(b) ans = 2 (2) b(2) ans = 3x3 double b(4) ans = 3x3 cell (3) b(3)= b = 1 3x3 double 3x3 cell b3= b = 1 3x3 double 第三章1. (1)a=eye(3) (2) a=100+100*rand(5,6) (3)a=1+sqrt(0.2)*randn(10,50) word 4 / 19 (4)b=ones(size(a) (5)a
5、+30*eye(size(a) (6)b=diag(diag(a) 2. b=rot90(a) c=rot90(a,-1) 3. b=inv(a) ;a的逆矩陣c=det(a) ;a的行列式的值d=a*b e=b*a d=e 因此 a與 a-1是互逆的。4. a=4 2 -1;3 -1 2;12 3 0; b=2;10;8; x=inv(a)*b x = 5. (1) diag(a) ;主對角線元素ans = 1 1 5 9 triu(a) ;上三角陣ans = 1 -1 2 3 0 1 -4 2 0 0 5 2 0 0 0 9 tril(a) ;下三角陣ans = 1 0 0 0 5 1 0
6、 0 3 0 5 0 11 15 0 9 rank(a) ;秩ans = 4 norm(a) ;x數(shù)word 5 / 19 ans = cond(a) ;條件數(shù)ans = trace(a) ;跡ans = 16 2略6. a=1 1 0.5;1 1 0.25;0.5 0.25 2 a = v,d=eig(a) v = d = -0.0166 0 0 0 1.4801 0 第四章1.a=input(請輸入一個(gè) 4 位數(shù):);while (a9999) a=input(輸入錯誤,請重新輸入一個(gè)4位數(shù):); end b=fix(a/1000); c=rem(fix(a/100),10); d=rem
7、(fix(a/10),10); e=rem(a,10); b=b+7; c=c+7; d=d+7; e=e+7; b=rem(b,10); c=rem(c,10); d=rem(c,10); e=rem(e,10); g=b;b=d;d=g; g=c;c=e;e=g; a=1000*d+100*e+10*b+c; word 6 / 19 disp(加密后: ,num2str(a) 2.a=input(請輸入a: ); b=input(請輸入 b: ); c=input(請輸入 c: ); x=0.5:1:5.5; x1=(x=0.5&x=1.5&x=3.5&x=5.5)
8、; y1=a.*(x.2)+b.*x+c; y2=a*(sin(b)c)+x; y3=log(abs(b+c./x); y=y1.*x1+y1.*x2+y3.*x3; disp(y) 3.x=fix(rand(1,20)*89)+10; x1=fix(sum(x)/20); disp(平均數(shù)是: ,num2str(x1) m=(rem(x,2)=0&x=m a=m; elseif b x=linspace(-10,10,200); y=; for x0=x if x00 y=y,x0.2+(1+x0).(1/4)+5; elseif x0=0 y=y,0; elseif x0 plot
9、(x,y) word 13 / 19 fplot函數(shù):fplot(x0).*(x.2+(1+x).(1/4)+5),-10,10) 第六章1. a=randn(10,5) 1mean(a) ;均值 std(a) ;標(biāo)準(zhǔn)方差2max(max(a) ;最大元素 min(min(a) ;最小元素word 14 / 19 3b=sum(a,2) ;a每行元素的和 sum(b) ;a全部元素之和4sort(a) ;a的每列元素按升序排列 sort(a,2,descend) ;a的每行元素按將序排列2. 12x=1 4 9 16 25 36 49 64 81 100; y=1:10; x1=1:100;
10、y1=interp1(x,y,x1,cubic) 3. x=165 123 150 123 141; y=187 126 172 125 148; p=polyfit(x,y,3) p = 1.0e+003 * 2177.9x+8433 4. (1)p1=0 3 2;p2=5 -1 2;p3=1 0 -0.5; p=conv(conv(p1,p2),p3) p = 所以 p(x)=15x5+7x432-2x-2 (2) roots(p) ans = 0.7071 -0.7071 -0.6667 (3) i=0:10; xi=0.2*i; polyval(p,xi) ans = 5. (1) 建
11、立函數(shù)文件:function f=fxy(u) x=u(1);y=u(2); word 15 / 19 f=3.*x.2+2*x.*y+y.2 在命令窗口中輸入以下命令:u,fmin=fminsearch(fxy,1,1) 結(jié)果:u = 1.0e-004 * fmin = 2f=inline(-sin(x)-cos(x.2); fmax=fminbnd(f,0,pi) fmax = 6. 1x=pi/6 pi/4 pi/3; f=inline(sin(x).2+cos(x).2); dx = 0 0 0 x=pi/2時(shí)單獨(dú)計(jì)算:x=pi/2; f=inline(sin(x).2+cos(x).
12、2); diff(f(x,pi)/(pi/2) ans = 0 2x=1:3; f=inline(sqrt(x.2+1); dx=diff(f(x,4) 結(jié)果:dx = 7. 1f=inline(sin(x).5.*sin(5*x); quad(f,0,pi) ans = 2f=inline(1+x.2)./(1+x.4); quad(f,-1,1) ans = word 16 / 19 3f=inline(x.*sin(x)./(1+cos(x).2); quad(f,0,pi) ans = 4f=inline(abs(cos(x+y); dblquad(f,0,pi,0,pi) ans =
13、 8. n=64; %采樣點(diǎn)數(shù)t=5; %采樣時(shí)間終點(diǎn)t=linspace(0,t,n); %給出 n個(gè)采樣時(shí)間 ti i=1:n y=exp(-t); %求各采樣點(diǎn)樣本值y dt=t(2)-t(1); %采樣周期f=1/dt; % 采樣頻率y=fft(y); %計(jì)算 y 的快速傅里葉變換y f=y(1:n/2+1); %f(k)=y(k) f=f*(0:n/2)/n; %使頻率軸 f 從 0 開始plot(f,abs(f) %繪制振幅 - 頻率圖9. 1矩陣求逆法:a=2 3 5;3 7 4;1 -7 1; b=10;3;5; x=inv(a)*b x = word 17 / 19 矩陣除法
14、法:a=2 3 5;3 7 4;1 -7 1; b=10;3;5; x=ab x = 矩陣分解法:a=2 3 5;3 7 4;1 -7 1; b=10;3;5; l,u=lu(a); x=u(lb) x = 2方法同 110. 函數(shù)文件: line_solution(a,b) function x,y=line_solution(a,b) m,n=size(a); y=; if norm(b)0 if rank(a)=rank(a,b) if rank(a)=n disp(原方程組有唯一解x); x=ab; else disp(原方程組有無窮個(gè)解,特解為x,齊次方程組的根底解系為y); x=ab; y=null(a,r); end disp(方程組無解 ); x=; end else disp(原方程組有零解 x); x=zeros(n,1); if rank(a) in line_solution at 11 方程組無解x = y = 1.0000 0 0 0 11. 1f=inline(x-sin(x)./x); x=fzero(f,0.5) x = (2) f=inline(sin(x).2).*exp(-0.1.*x)-0.5.*abs(x); x=fzero(f,1.5) x = 12. 函數(shù)文件:function f=fxy(u) x=u(1) y=u(2) f(
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 健身私教課程合同及退款協(xié)議
- Unit 1 My classroom (教學(xué)設(shè)計(jì))-2024-2025學(xué)年人教PEP版英語四年級上冊
- 10《傳統(tǒng)美德 源遠(yuǎn)流長》 教學(xué)設(shè)計(jì)-2024-2025學(xué)年道德與法治五年級上冊統(tǒng)編版
- 2025屆高考生物備考教學(xué)設(shè)計(jì):第六章 遺傳的分子基礎(chǔ) 課時(shí)2 DNA分子的結(jié)構(gòu)、復(fù)制及基因的本質(zhì)
- Module 2 Unit 2 There are lots of beautiful lakes in China(教學(xué)設(shè)計(jì))-2024-2025學(xué)年外研版(三起)英語六年級上冊
- Module 10 Unit 2 教學(xué)設(shè)計(jì) 2024-2025學(xué)年外研版九年級英語上冊
- 白坪鄉(xiāng)農(nóng)貿(mào)市場施工合同
- 框架建筑合同范本
- 11 白樺 第一課時(shí) 教學(xué)設(shè)計(jì) -2023-2024學(xué)年語文四年級下冊統(tǒng)編版
- 土地承包合同范本個(gè)人
- Android移動應(yīng)用開發(fā)基礎(chǔ)教程-教案
- 第九屆鵬程杯五年級數(shù)學(xué)競賽初試真題
- 電梯結(jié)構(gòu)與原理-第2版-全套課件
- 《現(xiàn)代漢語》語音教學(xué)上課用課件
- 采購流程各部門關(guān)系圖
- 力士樂工程機(jī)械液壓培訓(xùn)資料(共7篇)課件
- 村光伏發(fā)電申請書
- 支氣管擴(kuò)張的護(hù)理PPT
- 施工現(xiàn)場專項(xiàng)消防安全檢查表
- 鋼結(jié)構(gòu)廠房吊裝安裝監(jiān)理控制要點(diǎn)演示文稿
- 讓水產(chǎn)動物第一口都吃上蝦奶粉(廖英杰)
評論
0/150
提交評論