資源描述:
《實驗6 Matlab數值計算》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、實驗6Matlab數值計算實驗目的:1、掌握數據統計與分析的方法;2、掌握數據插值和曲線擬合的方法及其應用;3、掌握多項式的常用運算。實驗內容:1.利用randn函數生成符合正態(tài)分布的10×5隨機矩陣A,進行如下操作:(1)求A的最大元素和最小元素;(2)求A的每行元素的和以及全部元素的和;(3)分別對A的每列元素按升序、每行元素按降序排列。a=randn(10,5);am=max(max(a));ai=min(min(a));ah=sum(a,2);az=sum(ah);al=sort(a);ahj=-sort(-a,2);disp('隨機矩陣為
2、:');adisp('最大值:');amdisp('最小值:');aidisp('每行和:');ahdisp('總和:');azdisp('列升序:');aldisp('行降序:');ahj隨機矩陣為:a=??-0.4326??-0.1867???0.2944??-0.3999??-1.6041??-1.6656???0.7258??-1.3362???0.6900???0.2573???0.1253??-0.5883???0.7143???0.8156??-1.0565???0.2877???2.1832???1.6236???0.7119???
3、1.4151??-1.1465??-0.1364??-0.6918???1.2902??-0.8051???1.1909???0.1139???0.8580???0.6686???0.5287???1.1892???1.0668???1.2540???1.1908???0.2193??-0.0376???0.0593??-1.5937??-1.2025??-0.9219???0.3273??-0.0956??-1.4410??-0.0198??-2.1707???0.1746??-0.8323???0.5711??-0.1567??-0.0592最
4、大值:am=???2.1832最小值:ai=??-2.1707每行和:ah=??-2.3288??-1.3287???0.0105???6.2215??-1.4895???3.3602???4.9201??-3.6964??-3.3998??-0.3025總和:az=???1.9666列升序:al=??-1.6656??-0.8323??-1.5937??-1.2025??-2.1707??-1.1465??-0.5883??-1.4410??-0.3999??-1.6041??-0.4326??-0.1867??-1.3362??-0.1567?
5、?-1.0565??-0.0376??-0.1364??-0.6918??-0.0198??-0.9219???0.1253??-0.0956???0.2944???0.6686??-0.8051???0.1746???0.0593???0.5711???0.6900??-0.0592???0.2877???0.1139???0.7143???0.7119???0.2193???0.3273???0.7258???0.8580???0.8156???0.2573???1.1892???1.0668???1.2540???1.1908???0.528
6、7???1.1909???2.1832???1.6236???1.2902???1.4151行降序:ahj=???0.2944??-0.1867??-0.3999??-0.4326??-1.6041???0.7258???0.6900???0.2573??-1.3362??-1.6656???0.8156???0.7143???0.1253??-0.5883??-1.0565???2.1832???1.6236???1.4151???0.7119???0.2877???1.2902??-0.1364??-0.6918??-0.8051??-1.14
7、65???1.1909???0.8580???0.6686???0.5287???0.1139???1.2540???1.1908???1.1892???1.0668???0.2193???0.0593??-0.0376??-0.9219??-1.2025??-1.5937???0.3273??-0.0198??-0.0956??-1.4410??-2.1707???0.5711???0.1746??-0.0592??-0.1567??-0.8323>>1.用3次多項式方法插值計算1-100之間整數的平方根。N149162536496481100平
8、方根12345678910x=[1,4,9,16,25,36,49,64,81,100];y=x.^(1/2);x1=[1