關(guān)于我們
書單推薦
新書推薦
|
MATLAB R2020a入門、精通與實戰(zhàn) 讀者對象:本書可以作為信號處理、自動控制、機械電子、自動化、電力電氣、通信工程等專業(yè)的教學(xué)用書,也以作為通信、電子、自動控制等領(lǐng)域的廣大科研工作者、工程師等的自學(xué)參考用書。
MATLAB是 MathWorks公司推出的高性能數(shù)值計算和可視化軟件,它集數(shù)值計算、矩陣運算和圖形可視化于一體,方便地應(yīng)用于算法開發(fā)、數(shù)據(jù)采集、數(shù)學(xué)建模、科學(xué)計算、系統(tǒng)仿真、數(shù)據(jù)分析等方面。本書基于R2020a版本,由淺入深且系統(tǒng)地介紹了MATLAB應(yīng)用。全書共13章,內(nèi)容涉及初識MATLAB、基礎(chǔ)知識、向量與矩陣、矩陣運算、數(shù)學(xué)函數(shù)、數(shù)據(jù)繪圖、圖形處理、程序設(shè)計、數(shù)值計算、符號計算、句柄圖形、輸入與輸出、 Simulink仿真。全書語言通俗易懂,內(nèi)容豐富翔實;突出以實例為中心的特點,通過大量的實例,實現(xiàn)理論與實踐的結(jié)合,可以幫助讀者快速、輕松地掌握 MATLAB。
劉浩,男,畢業(yè)于天津工業(yè)大學(xué)。04年獲得Adobe系列產(chǎn)品專家證書,ACCD平面設(shè)計師證書,CEAC國家信息產(chǎn)業(yè)平面設(shè)計師證書。上海碧海金沙設(shè)計總監(jiān),上海Nordri設(shè)計工作室(上海諾睿網(wǎng)絡(luò)信息科技有限公司)創(chuàng)始人兼任設(shè)計總監(jiān),北京拓撲人咨詢高級顧問,wps office簽約講師,復(fù)旦MBA港大項目組簽約講師。
第1 章 初識MATLAB ····································································································.1
1.1 MATLAB 的工作環(huán)境 ······························································································.2 1.1.1 操作界面 ·····································································································.2 1.1.2 當前文件夾窗口 ····························································································.2 1.1.3 命令行窗口 ··································································································.3 1.1.4 工作區(qū)窗口 ··································································································.5 1.2 通用命令 ··············································································································.6 1.2.1 常用命令 ·····································································································.6 1.2.2 快捷鍵 ········································································································.6 1.2.3 標點符號的含義 ····························································································.7 1.3 搜索路徑設(shè)置 ········································································································.7 1.4 MATLAB 的幫助系統(tǒng) ······························································································.9 1.4.1 使用幫助命令 ·······························································································.9 1.4.2 幫助導(dǎo)航系統(tǒng) ·····························································································.10 1.4.3 示例程序的幫助系統(tǒng) ····················································································.11 1.5 MATLAB 示例 ·····································································································.11 1.6 本章小結(jié) ············································································································.12 第2 章 基礎(chǔ)知識 ···········································································································.13 2.1 基本概念 ············································································································.14 2.1.1 常量和變量 ································································································.15 2.1.2 數(shù)組、矩陣、標量與向量 ··············································································.15 2.1.3 命令與函數(shù) ································································································.16 2.1.4 表達式與語句 ·····························································································.17 2.2 數(shù)據(jù)類型 ············································································································.17 2.2.1 數(shù)值類型 ···································································································.18 2.2.2 邏輯類型 ···································································································.20 2.2.3 字符和字符串 ·····························································································.20 2.2.4 結(jié)構(gòu)體類型 ································································································.20 2.2.5 單元數(shù)組類型 ·····························································································.23 MATLAB R2020a 入門、精通與實戰(zhàn) VI 2.2.6 函數(shù)句柄 ···································································································.24 2.3 運算符 ···············································································································.25 2.3.1 算術(shù)運算符 ································································································.25 2.3.2 關(guān)系運算符 ································································································.26 2.3.3 邏輯運算符 ································································································.27 2.3.4 運算優(yōu)先級 ································································································.28 2.4 字符串 ···············································································································.29 2.4.1 字符串的構(gòu)造 ·····························································································.29 2.4.2 字符串的比較 ·····························································································.31 2.4.3 字符串查找和替換函數(shù) ·················································································.32 2.4.4 字符串與數(shù)值的轉(zhuǎn)換 ····················································································.32 2.5 本章小結(jié) ············································································································.33 第3 章 向量與矩陣 ········································································································.34 3.1 向量 ··················································································································.35 3.1.1 創(chuàng)建向量 ···································································································.35 3.1.2 向量的加減乘除運算 ····················································································.36 3.1.3 向量的點積和叉積運算 ·················································································.37 3.2 矩陣 ··················································································································.38 3.2.1 矩陣的構(gòu)造 ································································································.38 3.2.2 矩陣的拓展與裁剪 ·······················································································.39 3.2.3 矩陣下標引用 ·····························································································.42 3.2.4 矩陣信息的獲取 ··························································································.43 3.2.5 矩陣結(jié)構(gòu)的改變 ··························································································.44 3.3 稀疏矩陣 ············································································································.45 3.3.1 創(chuàng)建和查看稀疏矩陣 ····················································································.45 3.3.2 稀疏矩陣的運算規(guī)則 ····················································································.46 3.4 本章小結(jié) ············································································································.47 第4 章 矩陣運算 ···········································································································.48 4.1 矩陣分析 ············································································································.49 4.1.1 范數(shù) ·········································································································.49 4.1.2 矩陣的秩 ···································································································.50 4.1.3 矩陣的行列式 ·····························································································.50 4.1.4 矩陣的跡 ···································································································.51 4.1.5 矩陣的正交空間 ··························································································.51 4.1.6 矩陣的化零矩陣 ··························································································.51 4.1.7 矩陣的約化行階梯形式 ·················································································.52 目錄 VII 4.1.8 矩陣空間之間的夾角 ····················································································.52 4.2 線性方程組 ·········································································································.53 4.2.1 線性方程組問題 ··························································································.53 4.2.2 線性方程組的一般解 ····················································································.53 4.2.3 恰定方程組的求解 ·······················································································.54 4.2.4 超定線性方程組的求解 ·················································································.54 4.3 矩陣分解 ············································································································.55 4.3.1 對稱正定矩陣的Cholesky 分解 ·······································································.55 4.3.2 一般方陣的高斯消元法 ·················································································.56 4.3.3 矩形矩陣的正交分解 ····················································································.57 4.4 矩陣的特征值和特征向量 ·······················································································.58 4.5 非線性矩陣運算 ···································································································.59 4.5.1 矩陣指數(shù)運算 ·····························································································.59 4.5.2 矩陣對數(shù)運算 ·····························································································.60 4.5.3 矩陣開平方運算 ··························································································.60 4.5.4 一般非線性矩陣運算 ····················································································.61 4.6 本章小結(jié) ············································································································.61 第5 章 數(shù)學(xué)函數(shù) ···········································································································.62 5.1 初等函數(shù)運算 ······································································································.63 5.1.1 三角函數(shù) ···································································································.63 5.1.2 指數(shù)和對數(shù)函數(shù) ··························································································.64 5.1.3 復(fù)數(shù)函數(shù) ···································································································.65 5.1.4 截斷和求余函數(shù) ··························································································.66 5.2 特殊數(shù)學(xué)函數(shù)運算 ································································································.67 5.2.1 特殊函數(shù) ···································································································.67 5.2.2 坐標變換函數(shù) ·····························································································.71 5.2.3 數(shù)論函數(shù) ···································································································.71 5.3 本章小結(jié) ············································································································.72 第6 章 數(shù)據(jù)繪圖 ···········································································································.73 6.1 二維圖形的繪制 ···································································································.74 6.1.1 plot 二維繪圖命令 ·······················································································.74 6.1.2 多次疊圖和多子圖操作 ·················································································.77 6.1.3 fplot 二維繪圖命令 ······················································································.79 6.1.4 ezplot 二維繪圖命令 ·····················································································.80 6.2 三維圖形的繪制 ···································································································.81 6.2.1 plot3 ·········································································································.81 6.2.2 三維網(wǎng)格圖和三維曲面圖的繪制 ·····································································.82 MATLAB R2020a 入門、精通與實戰(zhàn) VIII 6.2.3 其他三維繪圖命令 ·······················································································.83 6.3 特殊圖形的繪制 ···································································································.85 6.3.1 二維特殊圖形函數(shù) ·······················································································.86 6.3.2 三維特殊圖形函數(shù) ·······················································································.92 6.3.3 特殊坐標軸函數(shù) ··························································································.95 6.3.4 四維表現(xiàn)圖(三維體切片平面) ·····································································.98 6.4 本章小結(jié) ············································································································.99 第7 章 圖形處理 ··········································································································.100 7.1 圖形標識 ···········································································································.101 7.1.1 坐標軸與圖形標注 ······················································································.101 7.1.2 圖形的文本標注 ·························································································.102 7.1.3 圖例的標注 ·······························································································.103 7.2 圖形控制 ···········································································································.104 7.2.1 圖形數(shù)據(jù)取點 ····························································································.104 7.2.2 坐標軸控制 ·······························································································.105 7.2.3 視角與透視控制 ·························································································.108 7.2.4 圖形色彩控制 ····························································································.111 7.2.5 光照控制 ··································································································.115 7.3 圖形窗口的操作 ··································································································.117 7.3.1 圖形窗口的創(chuàng)建 ·························································································.118 7.3.2 圖形窗口的菜單操作 ···················································································.118 7.3.3 圖形窗口工具欄 ·························································································.122 7.3.4 圖形的打印與輸出 ······················································································.124 7.4 本章小結(jié) ···········································································································.124 第8 章 程序設(shè)計 ··········································································································.125 8.1 M 文件 ··············································································································.126 8.1.1 函數(shù) ········································································································.126 8.1.2 腳本 ········································································································.127 8.2 語法規(guī)則 ···········································································································.128 8.2.1 程序設(shè)計中的變量 ······················································································.128 8.2.2 編程方法 ··································································································.130 8.2.3 順序語句 ··································································································.130 8.2.4 循環(huán)語句 ··································································································.130 8.2.5 條件語句 ··································································································.131 8.2.6 其他流程控制語句 ······················································································.133 8.3 程序調(diào)試 ···········································································································.134 8.3.1 直接調(diào)試法 ·······························································································.134 8.3.2 工具調(diào)試法 ·······························································································.135 目錄 IX 8.3.3 程序調(diào)試命令 ····························································································.137 8.3.4 程序剖析 ··································································································.138 8.4 程序設(shè)計與實現(xiàn) ··································································································.142 8.4.1 建立數(shù)學(xué)模型 ····························································································.142 8.4.2 代碼編寫 ··································································································.143 8.5 本章小結(jié) ···········································································································.144 第9 章 數(shù)值計算 ··········································································································.145 9.1 線性方程組的解法 ·······························································································.146 9.1.1 解線性方程組的直接法 ················································································.146 9.1.2 解線性方程組的迭代法 ················································································.148 9.1.3 利用MATLAB 求解線性方程組 ·····································································.150 9.2 數(shù)值逼近方法 ·····································································································.153 9.2.1 插值 ········································································································.153 9.2.2 曲線擬合 ··································································································.158 9.2.3 數(shù)值積分 ··································································································.161 9.3 常微分方程(組)的數(shù)值求解 ················································································.163 9.3.1 常微分方程初值問題的離散化 ·······································································.164 9.3.2 常微分方程初值問題 ···················································································.165 9.4 數(shù)據(jù)分析和多項式 ·······························································································.170 9.4.1 基本數(shù)據(jù)分析函數(shù) ······················································································.170 9.4.2 多項式函數(shù) ·······························································································.173 9.5 本章小結(jié) ···········································································································.175 第10 章 符號計算 ········································································································.176 10.1 符號運算入門 ···································································································.177 10.1.1 求方程的根 ·····························································································.177 10.1.2 求函數(shù)的導(dǎo)數(shù) ··························································································.177 10.1.3 求解微分方程 ··························································································.178 10.2 符號對象的創(chuàng)建和使用 ·······················································································.178 10.2.1 創(chuàng)建符號對象和表達式 ··············································································.178 10.2.2 符號對象的基本運算 ·················································································.181 10.3 符號表達式的操作 ·····························································································.182 10.3.1 符號表達式的替換 ····················································································.182 10.3.2 精度計算 ································································································.183 10.3.3 符號表達式的化簡 ····················································································.184 10.4 符號微積分及其變換 ··························································································.186 10.4.1 符號表達式的微分運算 ··············································································.186 10.4.2 符號表達式的級數(shù)與積分 ···········································································.188 10.4.3 符號積分變換 ··························································································.189 MATLAB R2020a 入門、精通與實戰(zhàn) X 10.5 符號矩陣的計算 ································································································.191 10.5.1 代數(shù)基本運算 ··························································································.191 10.5.2 線性代數(shù)運算 ··························································································.191 10.5.3 特征值分解 ·····························································································.192 10.5.4 約當標準型 ·····························································································.192 10.5.5 奇異值分解 ·····························································································.193 10.6 符號方程求解 ···································································································.193 10.6.1 代數(shù)方程的求解 ·······················································································.194 10.6.2 微分方程的求解 ·······················································································.195 10.7 可視化數(shù)學(xué)分析窗口 ··························································································.196 10.7.1 圖示化符號函數(shù)計算器 ··············································································.196 10.7.2 Taylor 級數(shù)逼近分析器···············································································.197 10.8 本章小結(jié) ·········································································································.198 第11 章 句柄圖形 ········································································································.199 11.1 句柄圖形體系 ···································································································.200 11.1.1 圖形系統(tǒng) ································································································.200 11.1.2 句柄圖形的概念 ·······················································································.200 11.1.3 對象屬性及其檢測和變更 ···········································································.202 11.2 圖形對象的操作 ································································································.205 11.2.1 創(chuàng)建圖形對象 ··························································································.206 11.2.2 查找對象 ································································································.207 11.2.3 圖形對象的位置 ·······················································································.208 11.2.4 文本對象的位置 ·······················································································.209 11.3 屬性默認值和factory 屬性及打印位置 ····································································.211 11.3.1 設(shè)置屬性默認值 ·······················································································.211 11.3.2 factory 屬性 ·····························································································.214 11.3.3 打印位置 ································································································.214 11.4 句柄的使用方法 ································································································.215 11.4.1 訪問對象句柄 ··························································································.215 11.4.2 使用句柄操作圖形對象 ··············································································.216 11.4.3 刪除對象 ································································································.217 11.4.4 控制圖形輸出 ··························································································.217 11.4.5 在M 文件中保存句柄 ················································································.219 11.5 句柄圖形的應(yīng)用舉例 ··························································································.220 11.6 本章小結(jié) ·········································································································.222 第12 章 輸入與輸出 ·····································································································.223 12.1 文件的打開與關(guān)閉 ·····························································································.224 12.1.1 打開文件 ································································································.224 目錄 XI 12.1.2 關(guān)閉文件 ································································································.225 12.2 文件的讀取與寫入 ·····························································································.225 12.2.1 讀取二進制文件 ·······················································································.225 12.2.2 寫入二進制文件 ·······················································································.227 12.2.3 寫入文本文件 ··························································································.228 12.2.4 讀取文本文件 ··························································································.230 12.2.5 文件格式化和二進制輸入/輸出比較 ······························································.231 12.3 文件位置控制和狀態(tài)函數(shù) ····················································································.233 12.3.1 exist 函數(shù) ································································································.234 12.3.2 ferror 函數(shù) ·······························································································.235 12.3.3 feof 函數(shù) ·································································································.235 12.3.4 ftell 函數(shù) ·································································································.235 12.3.5 frewind 函數(shù) ····························································································.235 12.3.6 fseek 函數(shù) ·······························································································.235 12.4 本章小結(jié) ·········································································································.237 第13 章 Simulink 仿真 ·································································································.238 13.1 Simulink 概論 ····································································································.239 13.1.1 Simulink 簡介···························································································.239 13.1.2 啟動Simulink ··························································································.239 13.1.3 Simulink 模型的特點··················································································.241 13.1.4 Simulink 實例···························································································.243 13.2 Simulink 模型創(chuàng)建 ······························································································.245 13.2.1 模塊操作 ································································································.245 13.2.2 信號線操作 ·····························································································.246 13.2.3 模型的注釋 ·····························································································.248 13.2.4 系統(tǒng)建模和系統(tǒng)仿真的基本步驟 ··································································.249 13.2.5 信源Source ·····························································································.253 13.2.6 信宿Sink ································································································.259 13.2.7 過零檢測 ································································································.264 13.2.8 仿真配置 ································································································.266 13.2.9 啟動仿真 ································································································.270 13.3 子系統(tǒng)的創(chuàng)建與封裝 ··························································································.271 13.3.1 子系統(tǒng)介紹 ·····························································································.271 13.3.2 創(chuàng)建子系統(tǒng) ·····························································································.272 13.3.3 封裝子系統(tǒng) ·····························································································.273 13.4 仿真模型的分析 ································································································.276 13.4.1 確定模型的狀態(tài) ·······················································································.276 13.4.2 平衡點的分析 ··························································································.277 MATLAB R2020a 入門、精通與實戰(zhàn) XII 13.4.3 微分方程的求解 ·······················································································.278 13.4.4 代數(shù)環(huán) ···································································································.279 13.5 仿真的運行 ······································································································.280 13.5.1 啟動仿真 ································································································.280 13.5.2 仿真的配置 ·····························································································.281 13.5.3 觀測仿真結(jié)果 ··························································································.285 13.5.4 仿真調(diào)試 ································································································.286 13.6 S 函數(shù) ·············································································································.287 13.6.1 S 函數(shù)的工作原理 ·····················································································.287 13.6.2 編寫S 函數(shù) ·····························································································.287 13.7 Simulink 與MATLAB 結(jié)合建模實例 ·······································································.291 13.8 本章小結(jié) ·········································································································.294 附錄A Simulink 模塊庫 ·······························································································.295 參考文獻 ·······················································································································.304
你還可能感興趣
我要評論
|