已阅读5页,还剩35页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
matlabprogrammingforengineers room414 ee ac sysu emails ynzhang ieee org zhynong yunongzhang 张雨浓 whatismatlab whydowelearnmatlab howdowelearnmatlab introduction whathaveyoulearnedfrommatlab abriefhistoryofmatlab engineeringandscientificapplicationsinvolvealotof numbercrunching formanyyears themainlanguageforthiswasfortran first highlevel programminglanguage andespeciallydesignedfornumericalcomputing here safortrancodetosolveax2 bx c 0 csolveaquadraticequation thisisacomment desc b b 4 a cif desc lt 0 0 goto10desc sqrt desc x1 b desc 2 0 a x2 b desc 2 0 a write 6 solutionsare x1 and x2return10write 6 equationhascomplexroots return problemsusingfortran numbercrunching onacomputercanbetricky problemsthatoccurare lossofprecisionandinaccurateresults x 0 1y 1 0 10 xy should equal0 butprobablydoesnot underflowandoverflow x 1 0e20 x x toobig efficientcodingofalgorithmsnotalwaysobviousdo10n 1 10000010y n sqrt 2 0 x n lessefficient cf inefficientprogrammingerrors solvingalinearsysteminfortran here safortrancodetosolvealinearsystemb a x solveforx itdoesn tcheckfordegeneracyorzeros csolveb a xforx cnisdimensionofvectorsandmatrixcdoesnotuserowinterchange scaling subroutinelinsys n a x b tmp integerndoubleprecisiona n n x n b n doubleprecisiontmp n ratioc forwardeliminationdo13j 1 n 1do12i j 1 nratio a i j a j j a i a i ratio row j do11k j 1 n11a i k a i k ratio a j k a i j 0 0x i x i ratio x j 12continue11continuecontinued c backwardssubstitutionx n x n a n n do21i n 1 1 1tmp x i do20j i 1 n20tmp tmp a i j x j x i tmp a i i 21continuereturnend thisisjustasmallexample afullprogrammaybethousandsoflineslong needfornumericallibraries theu s governmentrecognizedtheseproblems andtheinefficiencyofmanyengineersallwritingthesamealgorithms againandagain so theycommissionednumericalanalyststowritegoodqualityalgorithmsforcommontasks maketheresultsfreelyavailableas libraries ofsubroutinesthananyonecanuseintheirprograms librariesareavailableat lib org examplesofnumericallibraries blas basiclinearalgebrasubroutines operationsonvectors likeaddingtovectors dotproduct norm linpack linearalgebrasubroutinesforvector matrixoperations solvinglinearsystems factoringamatrix invertingamatrix laterreplacedbylapack eispack computeeigenvaluesandeigenvectorsofmatrices example solvea x businglinpack c factortheamatrixcallsgefa a n n ipvt info c copybvectorintoxvectorcallscopy n b 1 x 1 c solvethesystemofequationscallsgesl a n n ipvt x 0 stillnoteasyenough clevemoler mathematician c s professor andco authoroflinpack thoughtthisisstilltoomuchwork writefortran compile debug compile run hewantedtogivestudentseasyaccesstolinpack so hewrotematlab matrixlaboratory interactiveeasyinput easyoutputoperationsonawholevectorormatrixatonceexample solveb a xinmatlab x a b when immediatepopularity matlabquicklybecamequitepopularandusedforbothteachingandresearch itwasalsofree anengineer jacklittle sawmatlabduringalecturebyclevemoleratstanforduniversity hesawthecommercialpotentialand withpermission rewrotematlabincadded m files storedprograms addedmanynewfeaturesandlibrariesfoundedthemathworkstomarketit when softwareprinciples matlabillustratessomeusefuldesignconceptsforsoftware fortran c javacompiler linearalgebralibraries matlab matlab toolkits matlab m files standardbaseplatform modular reusablesoftwarecomponents extensibleusing toolkits oruser contributedprogramscalledm files interactiveuserinterface hidesboringdetails matlabtoday millionsofusers astandardtoolinbothprofessionalandacademicuse toolboxes providingfunctionsformanyapplications controlsystemsidentificationneuralnetworksbio informaticsstatisticsandtime seriesanalysiscandosymbolicmathematics too simulink guibasedsimulationtool matrixlaboratoryhigh performancelanguagefortechnicalcomputingcomputation visualization andprogramminginaneasy to useenvironment summary university levelcomputer programminglanguage cf java c fortran vb andmachine levelcpa typicalapplications mathandcomputationalgorithmdevelopmentmodelling simulation andprototypingdataanalysis exploration andvisualizationscientificandengineeringgraphicsapplicationdevelopment includinggraphicaluserinterfacebuilding applications example1 applications example1 cont solutionofode x 3 y x y xz 26 5x yz xy z butterflyeffect ode45functioninmatlab applications example2 applications example2 cont loadinganimage a imread picture jpg imshow a applications example2 cont showredplane a 2 3 0 imshow a loadinganimage a imread picture jpg imshow a applications example2 cont showgreenplane a 13 0 imshow a applications example2 cont showblueplane a 1 2 0 imshow a why dataanalysis applications example3 stockmarket predictedbyneuralnetworktoolboxinmatlabbp rbfneuralnetworktrainingthenetwork trainfunction applications example3 cont predictingexample applications example3 cont de noiseexample applications example3 cont advantagesofmatlab easetouseinterpretedlanguage likebasic integrateddevelopmentenvironment onlinedocumentation manuals anddemos etc platformindependenceindependenceofoperationsystemsandcomputers windows95 98 me nt 2000 xp unix linux andsuper computers predefinedfunctionsextensivelibraryofpredefinedfunctions suchasarithmeticmean standarddeviation median etc toolboxessuchascommunications controlsystems signalprocessing graphicaluserinterfaceinteractive easiertouseforinexperiencedusers advantagesofmatlab cont howtodefine slowforsomekindsofprocessesinterpretedlanguagenotdesignedforlarge scalesystemdevelopmenthighcostexpensiveforindividuals disadvantagesofmatlab matlabenvironment matlabdesktopincludesthefollowingwindows thecommandwindow thecommandhistorywindow launchpad workspace currentdirectory matlabenvironment cont thecommandwindow allowuserstoentercommandsat underthecommandpromptmatlabcalculatestheansweroncetheenterkeyispressedellipsis isusedifastatementistoolong x1 1 1 2 1 3 1 4 1 5 1 6 x1 1 1 2 1 3 1 4 1 5 1 6 cf ellipse thecommandhistorywindow displayalistofthecommandstypedbeforere executeacommandbydouble clickingitdeleteacommandbyrightclickingitandselectingtheitem deletesection fromthepopupmenu whatif thelaunchpad atreeofdocumentation demos andrelatedtoolsinstalledhere theworkspace computermemoryoccupiedbyvariablesandarraysusedbymatlabwhoslistvariablesandarraysinthecurrentworkspace theedit debugandfigurewindows anedit debugwindowisusedtocreateanew mfileortomodifyanexistingone clicktoolbaricontocreateanewoneclicktoolbaricontomodifyanexistingone afigurewindowisusedtodisplaymatlabgraphics importantcommands demo torunmatlab sbuilt indemonstrationsclc toclearthecontentsofthecommandwindowclf toclearthecontentsofthecurrentfigurewindowclear toclearthevariablesintheworkspace c ctrl c abortcommand toexecutecommandsofcomputer soperatingsystemdiary tocopyallinputandoutputdisplayedinthecommandwindowdiaryoff tosuspendinputintothediaryfilediaryon toresumeinputagain copyjzsf mjzsftest m searchingandlocatingfiles 1 itlooksforthenameasavariable ifitisavariable matlabdisplaysthecurrentcontentsofthevariable 2 itcheckstoseeifthenameisabuilt infunctionorcommand ifitis matlabexecutesthatfunctionorcommand 3 itcheckstoseeifthenameisanm fileinthecurrentdirectory ifitis matlabexecutesthatfunctionorcommand 4 itcheckstoseeifthenameisanm fileinanydirectoryinthesearchpath ifitis matlabexecutesthatfunctionorcommand searchingandlocatingfiles cont rememberinmindneveruseavariablewiththesamenameasamatlabfunctionorcommand otherwise thatfunctionorcommandwillbecomeinaccessible nevercreateanm filewiththesamenameasamatlabfunctionorcommand sin 5 sin 1 answer 5wrong whichtofindoutwhichversionofthefile andwhereitislocated searchingandlo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年浙江广厦建设职业技术大学单招综合素质考试题库参考答案详解
- 2026年四川汽车职业技术学院单招职业技能考试题库及参考答案详解一套
- 2026年河北建材职业技术学院单招职业技能考试题库及参考答案详解1套
- 2026年上海应用技术大学单招职业适应性考试题库及参考答案详解
- 2026年荆州职业技术学院单招综合素质考试题库及参考答案详解一套
- 2026年黑龙江农垦职业学院单招综合素质考试题库含答案详解
- 2026年闽南理工学院单招职业倾向性考试题库附答案详解
- 2026年四川现代职业学院单招职业技能考试题库及答案详解一套
- 2026年黄冈职业技术学院单招职业倾向性考试题库及答案详解一套
- 2025年赣州市章贡区市场监督管理局招聘临时工作人员1人笔试考试参考试题及答案解析
- 2025年肺功能证考试题及答案
- 《无机化学》期末考试复习题库(附答案)
- 2025年河北工业职业技术大学第二次公开招聘工作人员25名历年真题汇编及答案解析(夺冠)
- 2025年湖南衡阳衡山县社区专职网格员、警务辅助人员招聘47人笔试考试参考试题及答案解析
- 携手并进+圆梦高考-2025-2026学年高三上学期家长会
- 西游记第86回课件
- 公司治理期末考试及答案
- 玄武门之变教学课件
- 普通高中英语课程标准(2020版vs2025日常修订版)核心变化对照表
- 科比课件-勤奋
- 2025+急性胰腺炎护理查房
评论
0/150
提交评论