袁越強MATLAB上機實驗報告一
平頂山學院計算機語言類課程實驗報告(一)
課程名稱院系學號實驗日期MATLAB語言及應用電氣信息工程學院實驗機房專業(yè)電氣工程及其自動化姓名任課教師王凱實驗學時23305班級機器號實驗成績二班一.實驗名稱:MATLAB求解線性方程組和矩陣的初等計算二.實驗目的和要求1、掌握利用MATLAB程序編輯器編寫應用程序的方法;2、掌握MATLAB求解線性方程組的方法;3、掌握MATLAB進行矩陣的初等計算的方法三.實驗內(nèi)容1、求線性方程組的解3x4y7z12w45x7y4z2w3x8z5w96x5y2z10w8481315432,B6238,求C1=A*B’;C2=A’*B;C3=A.*B,并592、設A36271281397求它們的逆陣。3、(a)列出4×4階的單位矩陣I、魔方矩陣M和2×4階的全幺矩陣A、全零矩陣B;IA"B"(b)將這些矩陣拼接為8×8階的矩陣C;其中CA;BM(c)求出C的第2、4、6、8行,組成4×8階的矩陣C1,再取C1的第2、4、6、8列,組成4×4階的矩陣C2。4、課本P84練習1注意:指數(shù)函數(shù)為exp;3通過平方根函數(shù)為sqrt或者冪運算符;兩個含自變量數(shù)組相乘或者相除,需要借助于點乘或者點除
四.實驗設計方案(實驗步驟或開發(fā)過程)1.%方程的解clearallClcA=[3,4,-7,-12;5,-7,4,2;1,0,8,-5;-6,5,-2,10];B=[4;-3;9;-8];S=A\\B2.%矩陣的運算clearallclcA=[14813;-36-5-9;2-7-12-8]B=[543-2;6-23-8;-13-97]C1=A*B"C2=A"*BC3=A.*B3.%矩陣的輸入clearallclcI=eye(4)M=magic(4)A=ones(2,4)B=zeros(2,4)C=[I[A"B"];[A;B]M]C1=C([2468],[1:end])C2=C1([1234],[2468])4.%練習題一clearallclct=[-1:0.01:1]y=sqrt(3)/2*exp(-4*t).*sin(4*sqrt(3)*t+pi/3)
五.實驗中存在問題及解決辦法在實驗中,關于“先買票后上車”問題沒搞清楚,導致第4題運行不出來。最后經(jīng)過老師的指點和翻閱課本找到問題所在,成功解決。六.實驗結果1.S=-1.4841-0.68160.5337-1.24292.C1=[19-8230;12273;-385429]C2=[-1516-2436;63-1793-105;226117-60;194684-10]3.I=[1000;0100;0010;0001]M=[162313;511108;97612;414151]A=[1111;1111]B=[0000;0000]C=[10001100;01001100;00101100;00011100;1111162313;1111511108;000097612;0000414151]C1=[01001100;00011100;1111511108;0000414151]C2=[1010;0110;11118;00141]4.(Columns1through10)18.507920.633522.468924.025025.313826.347927.140527.705328.056428.2080Columns11through2028.174627.970527.610227.107826.477425.732824.887223.953622.944521.8720Columns21through3020.747419.581818.385417.168015.938714.705813.477412.260511.06199.8874(Columns31through40)8.74247.63176.55955.52944.54453.60742.7201*.88441.10130.3717(Columns41through50)-0.3042-0.9262-1.4947-2.0102-2.4738-2.8866-3.2498-3.5652-3.8344-4.0593(Columns51through60)-4.2420-4.3845-4.4892-4.5582-4.5939-4.5985-4.5746-4.5244-4.4502-4.3544(Columns61through70)-4.2392-4.1067-3.9592-3.7987-3.6272-3.4466-3.2587-3.0652-2.8677-2.6678(Columns71through80)-2.4669-2.2662-2.0670-1.8705-1.6775-1.4891-1.3060-1.1290-0.9586-0.7954(Columns81through90)-0.6399-0.4924-0.3533-0.2226-0.10060.01260.11700.21270.29970.3782(Columns91through100)0.44830.51030.56440.61080.64990.68210.70750.72670.73990.7475(Columns101through110)0.75000.74770.74090.73010.71570.69790.67730.65400.62860.6012(Columns111through120)0.57220.54200.51070.47870.44620.41350.38070.34820.31590.2843(Columns121through130)0.25330.22310.19390.16570.13870.11
0.08840.06530.04350.0231(Columns131through140)0.0042-0.0134-0.0295-0.0441-0.0574-0.0693-0.0799-0.0891-0.0971-0.1039(Columns141through150)-0.1095-0.1140-0.1175-0.1200-0.1215-0.1222-0.1221-0.1213-0.1197-0.1176(Columns151through160)-0.1148-0.1116-0.1080-0.1039-0.0996-0.0949-0.0901-0.0850-0.0799-0.0746(Columns161through170)-0.0693-0.0639-0.0586-0.0533-0.0481-0.0430-0.0381-0.0332-0.0286-0.0241(Columns171through180)-0.0198-0.0158-0.0119-0.0083-0.0049-0.00170.00120.00390.00640.0086(Columns181through190)0.01070.01240.01400.01540.01660.01760.01840.01900.01940.0197(Columns191through200)0.01990.01990.01980.01960.01930.01890.01840.01780.01720.0165(Column201)0.0157七.附錄(源程序清單).1.%clearallclcA=[3,4,-7,-12;5,-7,4,2;1,0,8,-5;-6,5,-2,10];B=[4;-3;9;-8];S=A\\B2.%clearallclcA=[14813;-36-5-9;2-7-12-8]B=[543-2;6-23-8;-13-97]C1=A*B"C2=A"*BC3=A.*B3.clearallclcI=eye(4)M=magic(4)A=ones(2,4)B=zeros(2,4)C=[I[A"B"];[A;B]M]C1=C([2468],[1:end])C2=C1([1234],[2468])4.clearallclct=[-1:0.01:1]y=sqrt(3)/2*exp(-4*t).*sin(4*sqrt(3)*t+pi/3)
友情提示:本文中關于《袁越強MATLAB上機實驗報告一》給出的范例僅供您參考拓展思維使用,袁越強MATLAB上機實驗報告一:該篇文章建議您自主創(chuàng)作。
來源:網(wǎng)絡整理 免責聲明:本文僅限學習分享,如產(chǎn)生版權問題,請聯(lián)系我們及時刪除。