您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 交通运输 > matlab programing for engineers英文课件
MATLABProgrammingforEngineers2TextsS.J.Chapman,MATLABProgrammingforEngineers(2ndedition)Reference精讲多练MATLAB,罗建军杨琦等,西安交通大学出版社3GradingLabwork:10%HW:10%Midterm:10%Final:70%TestsAnin-classopen-bookfinal41Introduction(1.1-1.5)2MATLABBasics(2.1-2.10,2.13,2.14)3Top-downProgramDesign(3.1-3.2)4RelationalandLogicalOperators(3.3,4.3)5BranchesandLoops(3.4,4.1,4.2,4.4)6Plotting(2.11,3.5,6.4,6.5)7User-definedFunctions(5.1-5.9)8ComplexDataandCharacterData(6.1-6.3)9Input/OutputFunctions(8.1-8.11)10SparseArrays,CellArrays,andStructures(7.1-7.5)ContentsIntroductiontoMATLAB6MATrixLABoratoryMATLABarrayAdvantagesofMATLABEaseofusePlatformindependencePredefinedfunctionsPlottingDisadvantagesofMATLABCanbeslow[aninterpretedlanguage]Expensive7MATLABEnvironmentMATLABDesktopCommandWindowFigureWindowsEdit/DebugWindowCommandHistoryWindowLaunchPadWorkspaceBrowserandArrayEditorHelpBrowserCurrentDirectoryBrowser8MATLABDesktopWorkspaceBrowserCommandWindowCurrentDirectoryBrowserCommandHistoryWindowTovieworchangethecurrentdirectoryHelpBrowser9MATLABDesktopLaunchPad10TheCommandWindowThecommandprompt()πispredefined,usepiEllipsis(…),continuingonthenextlinex1=1+1/2+1/3+1/4+1/5+1/6;andx1=1+1/2+1/3+1/4…+1/5+1/6;11TheCommandHistoryWindow12TheLaunchPad13TheEdit/DebugWindowCreatenewM-files“File/New/M-file”ClickingtheToolbariconOpenanexistingone“File/Open”ClickingtheToolbaricon14TheEdit/DebugWindow15FigureWindows16TheMATLABWorkspacewhosvar1clearDeletesallvariablesclearvar1var2…17TheWorkspaceBrowser18GettingHelpUsetheHelpBrowserSelectingtheHelpiconTypinghelpdeskorhelpwinintheCommandwindow19GettingHelpCommand_lineorientedwaytogethelpTypehelporhelpfun1inthecommandwindowSearchesforanexactfunctionnamematchTypelookforcommandSearchesthequicksummaryinformationineachfunctionforamatch20AFewImportantCommandsTypedemoorselect“demos”intheLaunchPadclcclfClear^c(control-c),abort!Invokeoperatingsystemcommanddiary(diaryfileneme,diaryoff,diaryon)21TheMATLABSearchPathEnteranameattheMATLABpromptLookforthenameasavariableChecktoseeifitisabuilt-infunctionorcommandChecktoseeifitisanM-fileinthecurrentdirectoryChecktoseeifitisanM-fileinanydirectoryinthesearchpath22TheMATLABSearchPathProgrammingPitfallsNeveruseavariablewiththesamenameasaMATLABfunctionorcommandNevercreateanM-filewiththesamenameasaMATLABfunctionorcommandExamineandmodifysearchpath“File/SetPath”,editpath,pathtoolpathcommand23UsingMATLABasaScratchpad+,-,*,/,^Forexampler=0.1;l=0.5;V=A*l;A=pi*r^2;V=A*lV=0.0157242020/1/30MathematicalModeling24MATLAB常用数学函数(1)三角函数和双曲函数名称含义名称含义名称含义sin正弦csc余割atanh反双曲正切cos余弦asec反正割acoth反双曲余切tan正切acsc反余割sech双曲正割cot余切sinh双曲正弦csch双曲余割asin反正弦cosh双曲余弦asech反双曲正割acos反余弦tanh双曲正切acsch反双曲余割atan反正切coth双曲余切acot反余切asinh反双曲正弦sec正割acosh反双曲余弦252020/1/30MathematicalModeling25MATLAB常用数学函数(2)指数函数名称含义名称含义名称含义expE为底的指数log1010为底的对数pow22的幂log自然对数log22为底的对数sqrt平方根取整函数和求余函数名称含义名称含义ceil向+∞取整rem求余数fix向0取整round向靠近整数取整floor向-∞取整sign符号函数mod模除求余262020/1/30MathematicalModeling26MATLAB常用数学函数(3)矩阵变换函数复数函数名称含义名称含义名称含义abs绝对值conj复数共轭real复数实部angle相角imag复数虚部名称含义名称含义fliplr矩阵左右翻转diag产生或提取对角阵flipud矩阵上下翻转tril产生下三角flipdim矩阵特定维翻转triu产生上三角rot90矩阵反时针90翻转reshape矩阵重新排列272020/1/30MathematicalModeling27MATLAB常用数学函数(4)矩阵函数名称含义名称含义cond矩阵的条件数det方阵的行列式dot矩阵的点积eig方阵的特征值和特征向量norm(A,1)矩阵A的1—范数norm(A)矩阵A的2—范数norm(A,’inf’)矩阵A的无穷范数norm(A,’fro’)矩阵A的F—范数rank矩阵的秩trace矩阵的迹inv方阵的逆pinv矩阵的伪逆lu矩阵的LU分解svd矩阵的奇异值分解chol矩阵的Cholesky分解hess矩阵的Hessenberg形式qr矩阵的QR正交三角分解orth矩阵行向量的标准正交基schur矩阵的Schur分解rref将矩阵转化为的阶梯阵282020/1/30MathematicalModeling28MATLAB常用数学函数(5)其他函数名称含义名称含义min最小值max最大值mean平均值median中位数std标准差diff相邻元素的差sort从小到大排序length个数norm欧氏(Euclidean)长度sum总和prod总乘积dot内积cumsum累计元素总和cumprod累计元素总乘积cross外积29HomeworkQuiz1.1Exercises1.1,1.4MATLABBasics31MATLABBasicsAprogramcanbeinputcommandbycommandusingthecommandline(linesstartingwith“»”ontheMATLABdesktop)asaseriesofcommandsusingafile(aspecialfilecalledM-file)Ifacommandisfollowedbyasemicolon(;),resultofthecomputationisnotshownonthecommandwindow32MATLABBasics:VariablesVariableisanamegiventoareservedlocationinmemoryclass_code=111;number_of_students=65;name='SichuanNormalUniversity';radius=5;area=pi*radius^2;33MATLABBasics:VariablesUsemeaningfulnamesforvariablesMATLABvariablenamesmustbeginwithalettercancontainanycombinationofletters,numbersandunderscore(_)mustbeuniqueinthefirst31charactersMATLABiscasesensitive:“name”,“Name”and“NAME”areconsidereddifferentvariablesNeveruseavariablewiththesamenameasaMATLABcommandNamingconvention:uselowercaseletters34MATLABBasics:ArraysThefundamentalunitofdataisarrayscalarvaluevectormatrix15-2321-410133140-311columnrow35MATLABBasics:InitializingVariablesInitializationusingassignmentstatementsx=5x=5y=x+1y=6vector=[1234]vector=123436matrix=[123;456]matrix=123456matrix=[123;45]???Errora=[5(2+4)]a=56MATLABBasics:InitializingVariables37Initializationusingshortcutstatementscolonoperatorfirst:increment:lastx=1:2:10x=13579y=0:0.1:0.5y=00.10.20.30.40.5MATLABBasics:Init
本文标题:matlab programing for engineers英文课件
链接地址:https://www.777doc.com/doc-3383625 .html