版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、星期三, 2008-4- 23, 20:08:07,Slide 1 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Chapter 2Fundamentals of MATLAB
2、Programming,Solving Applied Mathematical Problems with MATLAB,CRC/Taylor & Francis PressChinese version by Tsinghua University Press,PPT by Wenbin Dong and Jun Peng, Northeastern University, PRCProofread by Dingyu
3、Xue & YangQuan Chen,星期三, 2008-4- 23, 20:08:07,Slide 2 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Chapter 2
4、 Fundamentals of MATLAB Programming,Fundamentals of MATLAB ProgrammingFundamental Mathematical CalculationsFlow Control Structures of MATLAB LanguageWriting and Debugging MATLAB FunctionsTwo-dimensional GraphicsThre
5、e-dimensional GraphicsChapter summary,星期三, 2008-4- 23, 20:08:07,Slide 3 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press,
6、 2008,MATLAB has the following advantages:Clarity and high efficiencyScientific computation, covers almost all the useful topics in math and engineeringGraphics facilitiesComprehensive toolboxes and block-sets, desig
7、ned by experts of almost all disciplines Powerful simulation facilities, unite the sub-systems of different domains together,星期三, 2008-4- 23, 20:08:07,Slide 4 (of 103) Dingyü Xue and Yan
8、gQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.1 Fundamentals of MATLAB Programming,Variables and constants in MATLABData structuresBasic structure of MATLABColon expres
9、sions and sub-matrices extraction,星期三, 2008-4- 23, 20:08:07,Slide 5 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
10、,2.1.1 Variables and constants in MATLAB,Variables in MATLABStarting with a letter followed by other characters:Case-sensitive:Valid variable names: MYvar12, MY_Var12 and MyVar12_Invalid variable names: 12MyVar, _My
11、Var12Constants in MATLAB:eps, i, j, pi, NaN, Inf, i=sqrt(-1)lastwarn, lasterr,星期三, 2008-4- 23, 20:08:07,Slide 6 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mat
12、hematical Problems with MATLAB, CRC Press, 2008,2.1.2 Data structures,Double-precision data typeSymbolic data typeOther data types,星期三, 2008-4- 23, 20:08:07,Slide 7 (of 103) Dingyü Xue
13、and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Double-precision data type,IEEE standard, 64 bits (8 bytes),11 bits for exponential and 53 bits for numerical and a sign
14、 bit.Use double() to convert other types to double.Data range:Other data types:int8(), int16(), int32(), uint16(), uint32(),星期三, 2008-4- 23, 20:08:07,Slide 8 (of 103) Dingyü Xue and
15、YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Symbolic data type,Usually used in formula derivations and analytical solutionsvariable declarationdisplay the symbolic
16、variables in any precisionThe default value: 32 decimal digits.,星期三, 2008-4- 23, 20:08:07,Slide 9 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Prob
17、lems with MATLAB, CRC Press, 2008,Example 2.1,Display the first 300 digits of .MATLAB commandOne may further increase the number of digits to display. For extremely large number of digits, process may be slow,星期
18、三, 2008-4- 23, 20:08:07,Slide 10 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Other data types,Strings:String v
19、ariables are used to store messages.Multi-dimensional arrays:a direct extension of matrices with multiple indices.Cell arrays:to put a set of data of different types under a single variable, expressed by { }.Classe
20、s and objects:used in Object-Oriented Programming.,星期三, 2008-4- 23, 20:08:07,Slide 11 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATL
21、AB, CRC Press, 2008,2.1.3 Basic structures of MATLAB,Direct assignmentThe basic structure of this type of statement isA semicolon can prevent the results from display.Reserved variable: ansstore the latest statemen
22、ts without left-hand-variable,星期三, 2008-4- 23, 20:08:07,Slide 12 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Ex
23、ample 2.2,Enter matrix into MATLABCommandsOther commands,星期三, 2008-4- 23, 20:08:07,Slide 13 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems
24、 with MATLAB, CRC Press, 2008,Example 2.3,Enter complex matrix into MATLABMATLAB commands Things to avoid:,星期三, 2008-4- 23, 20:08:07,Slide 14 (of 103) Dingyü Xue and YangQuan Che
25、n, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Function call statementFunction call examplesOne function may be called in different waysBuilt-in functions, *.m functions, Anon
26、ymous functions, inline functionsOverload functions,Function call statements,星期三, 2008-4- 23, 20:08:07,Slide 15 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathe
27、matical Problems with MATLAB, CRC Press, 2008,2.1.4 Colon expressions and sub-matrices extraction,Colon expression is an effective way in defining row vectors.Start value , increment and final value .defau
28、lt increment: 1,星期三, 2008-4- 23, 20:08:07,Slide 16 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Example 2.4,For
29、 different increments, establish vectors for,星期三, 2008-4- 23, 20:08:07,Slide 17 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC
30、 Press, 2008,Sub-matrix Extraction,Basic format numbers of the rows numbers of the columns:, all the columns or rows, depending on the position of it,星期三, 2008-4- 23, 20:08:07,Slide 18 (of 103)
31、 Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Example 2.5,Different sub-matrices can be extracted from the given matrixMATLAB co
32、mmand,星期三, 2008-4- 23, 20:08:07,Slide 19 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.2 Fundamental Mathematic
33、al Calculations,Algebraic operations of matricesLogic operations of matricesRelationship operations of matricesSimplifications and presentations of analytical resultsBasic number theory computations,星期三, 2008-4- 23,
34、 20:08:07,Slide 20 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.2.1 Algebraic operations of matrices,Matrix t
35、ransposeMatrix addition and subtractionMatrix multiplicationsMatrix divisionsMatrix flip and rotationsMatrix powerMatrix dot operations,星期三, 2008-4- 23, 20:08:07,Slide 21 (of 103) Dingy&
36、#252; Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Matrix transpose,Matrix representation:Matrix A, n rows and m columns, is referred to as an mat
37、rixHermitian transposeSimple transpose,星期三, 2008-4- 23, 20:08:07,Slide 22 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC P
38、ress, 2008,Mathematical representationsDifficult to program under C, like A*BMATLAB implementationNote: any variable can be a scalarIf not compatible, error messages given,Matrix addition and subtraction,星期三, 2008
39、-4- 23, 20:08:07,Slide 23 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Math expressionMATLAB expressionNo
40、te: the dimension compatibility auto-checked,Matrix multiplication,星期三, 2008-4- 23, 20:08:07,Slide 24 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Pro
41、blems with MATLAB, CRC Press, 2008,Matrix left divisionSolve the linear equations:MATLAB solution:Least squares solutionIf A is a non-singular square matrix. Then,,Matrix division,星期三, 2008-4- 23, 20:08:07,Sli
42、de 25 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Matrix right divisionSolve the linear equations:MATLAB solut
43、ion:Least squares solutionIf A is a nonsingular square matrix. Then,More precisely,,星期三, 2008-4- 23, 20:08:07,Slide 26 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied
44、 Mathematical Problems with MATLAB, CRC Press, 2008,left-right flip:up-down flip:Rotate :How to rotate ?,Matrix flip and rotation,星期三, 2008-4- 23, 20:08:07,Slide 27 (of 103)
45、 Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,A is a square matrix, determine the matrix A to the power x.Math descriptionMATLAB command:
46、,Matrix power,星期三, 2008-4- 23, 20:08:07,Slide 28 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Matrix Dot operati
47、on,Element-by-element operationFor example:Another example,means,means,星期三, 2008-4- 23, 20:08:07,Slide 29 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathemati
48、cal Problems with MATLAB, CRC Press, 2008,Example 2.6,Cubic root of MATLAB commandsThe other two roots,星期三, 2008-4- 23, 20:08:07,Slide 30 (of 103) Dingyü Xue and YangQuan Chen, Sol
49、ving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.2.2 Logic operations of matrices,Logical variablesFor new version of MATLABNon-zero means logic 1Logical Operations (element-by-element)“
50、And” operation“Or” operation“Not” operationExclusive Or,星期三, 2008-4- 23, 20:08:07,Slide 31 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems wi
51、th MATLAB, CRC Press, 2008,2.2.3 Relationship operations of matrices,Allowed comparisons: >, >=, <, <=, ==,~=, find(), all(), any()Examples:,星期三, 2008-4- 23, 20:08:07,Slide 32 (of 103)
52、 Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.2.4 Simplifications and presentations of analytical results,Function simple() can be used to s
53、implify mathematical formula:Other commonly used simplification functionsnumden(), collect(), expand(), factor(),星期三, 2008-4- 23, 20:08:07,Slide 33 (of 103) Dingyü Xue and YangQuan C
54、hen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Example 2.7,Find the simplest form of the polynomialProcess it with various functionsExpand it,星期三, 2008-4- 23, 20:08:07,Slide
55、 34 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Two commands to use It is run on the dot operation basisCon
56、vert to LATEX expression,Variable substitution,星期三, 2008-4- 23, 20:08:07,Slide 35 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, C
57、RC Press, 2008,Example 2.8,FunctionUse taylor() to evaluate its Taylor expression and convert the results in LATEX,星期三, 2008-4- 23, 20:08:07,Slide 36 (of 103) Dingyü Xue and YangQuan Ch
58、en, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,By MATLAB \cos \left( b \right) -\sin \left( b \right) at+ \left( -1/2\,\cos \left( b \right) {a}^{2}+cd \right) {t}^{2}+1/6\,\sin \
59、left( b \right) {a}^{3}{t}^{3}+ \left( 1/24\,\cos \left( b \right) {a}^{4}-1/6\,cbndzppu^{3}-1/6\,{c}^{3}d \right) {t}^{4}-{\frac {1}{120}}\,\sin \left( b \right) {a}^{5}{t}^{5}By LaTeX,星期三, 2008-4- 23, 20:08:07,Slide 37
60、 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.2.5 Basic number theory computations,星期三, 2008-4- 23, 20:08:07,Sl
61、ide 38 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Example 2.9,Data set -0.2765, 0.5772,1.4597, 2.1091, 1.191,-1
62、.6187Observe the results from different rounding functions.,星期三, 2008-4- 23, 20:08:07,Slide 39 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems
63、with MATLAB, CRC Press, 2008,Example 2.10,Hilbert matrix can be specified with the statement A=hilb(3), perform the rational transformation.result,星期三, 2008-4- 23, 20:08:07,Slide 40 (of 103)
64、 Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,Example 2.11,1856120 , 1483720, get the GCD (greatest common divider), LCM (least common multiplier)
65、and prime factor decomposition to the least common multiplier,星期三, 2008-4- 23, 20:08:07,Slide 41 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems
66、 with MATLAB, CRC Press, 2008,Example 2.12,Prime numbers in 1-1000The prime numbers obtained,星期三, 2008-4- 23, 20:08:07,Slide 42 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied
67、 Mathematical Problems with MATLAB, CRC Press, 2008,2.3 Flow Control Structures of MATLAB Language,Loop control structuresConditional control structuresSwitch structureTrial structure,星期三, 2008-4- 23, 20
68、:08:07,Slide 43 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008,2.3.1 Loop control structures,The for loop structures
69、If v is a matrix, i pick up one column at a time,星期三, 2008-4- 23, 20:08:07,Slide 44 (of 103) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with M
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 高等應(yīng)用數(shù)學(xué)問(wèn)題的matlab求解06
- 高等應(yīng)用數(shù)學(xué)問(wèn)題的matlab求解05
- matlab數(shù)學(xué)軟件結(jié)課論文-高等應(yīng)用數(shù)學(xué)問(wèn)題的matlab求解_差分方程求解
- chap01高等應(yīng)用數(shù)學(xué)問(wèn)題的matlab求解中文
- 高等應(yīng)用數(shù)學(xué)問(wèn)題的matlab求解math-chap01-extended
- 《高等應(yīng)用數(shù)學(xué)問(wèn)題的matlab求解-第二版》math-chap07
- 應(yīng)用matlab求解經(jīng)典物理若干典型問(wèn)題
- matlab在高等數(shù)學(xué)中的應(yīng)用
- matlab求解夫妻過(guò)河問(wèn)題
- 應(yīng)用matlab將數(shù)學(xué)實(shí)驗(yàn)融入高等數(shù)學(xué)的探討
- 應(yīng)用matlab將數(shù)學(xué)實(shí)驗(yàn)融入高等數(shù)學(xué)的探討
- matlab在高等數(shù)學(xué)中的應(yīng)用[文獻(xiàn)綜述]
- 畢業(yè)論文應(yīng)用matlab求解經(jīng)典物理若干典型問(wèn)題
- 應(yīng)用matlab求解經(jīng)典物理若干典型問(wèn)題畢業(yè)論文
- 實(shí)變函數(shù)原理在分形學(xué)問(wèn)題求解中的應(yīng)用
- matlab在高等數(shù)學(xué)中的應(yīng)用[畢業(yè)論文]
- 非線性規(guī)劃問(wèn)題的matlab實(shí)現(xiàn)求解
- matlab求解夫妻過(guò)河問(wèn)題畢業(yè)論文
- matlab在高等數(shù)學(xué)中的應(yīng)用開(kāi)題報(bào)告 [開(kāi)題報(bào)告]
- 高等數(shù)學(xué)學(xué)問(wèn)點(diǎn)梳理
評(píng)論
0/150
提交評(píng)論