欢迎来到天天文库
浏览记录
ID:38879003
大小:183.98 KB
页数:17页
时间:2019-06-20
《Writing Fast MATLAB Code英文学习资料》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、WritingFastMATLABCodePascalGetreuerAugust11,2004Contents1TheProler22ArrayPreallocation33Vectorization53.1VectorizedComputations....................................53.2VectorizedLogic.........................................63.3Example1:Removingelements.........................
2、........73.4Example2:Piecewisefunctions.................................83.5Example3:Drawingimageswithmeshgrid..........................83.6Example4:Polynomialinterpolation..............................94ReferencingOperations114.1Subscriptsvs.Indices............................
3、..........114.2VectorizedSubscripts.......................................114.3VectorIndices...........................................124.4ReferenceWildcards,:......................................134.5DeletingSubmatriceswith[]..................................135Miscellaneous
4、Tricks135.1Convertanyarrayintoacolumnvector............................135.2Getthenumberofelementsinanarray............................145.3Boundavaluewithoutifstatements..............................145.4Findthemin/maxofamatrixorN-darray..........................145.5Repeating
5、/tilingvectorswithoutrepmat............................155.6VectorizeduseofsetonGUIobjects..............................156GoingFurther16MATLABisapopularprogramminglanguageforitssimplicityandbroadrangeoftoolsfortopicslikesignalprocessing,statistics,dierentialequations,andofcou
6、rse,matrices.Userscaneasilyaddtheirownm-lefunctionsforspecicapplications,furtherextendingMATLAB'susefulness.However,theMATLABprogramminglanguageisparsed{codeisinterpretedandtranslatedintocom-puteroperationsinrealtime{wherefasterlanguageslikeC/C++arecompiledaheadoftimeintothec
7、omputer'snativelanguage.Someadvantagestoparsinginrealtimearegreaterplatformindependence,robustness,andeasierdebugging.(AlsonotethatMATLAB'seval"functionhasnoC++equivalent.)Thedisadvantageofparsinginrealtimeissignicantlossinspeed,aswellasincreasedoverheadandlesslow-levelcontro
8、l.Tocompensate,MATLABoersmeanstohelpspeedupcode.Thisa
此文档下载收益归作者所有