chapter 1-matlab programming for engineerszyn

上传人:夏** 文档编号:592262595 上传时间:2024-09-20 格式:PPT 页数:40 大小:3.27MB
返回 下载 相关 举报
chapter 1-matlab programming for engineerszyn_第1页
第1页 / 共40页
chapter 1-matlab programming for engineerszyn_第2页
第2页 / 共40页
chapter 1-matlab programming for engineerszyn_第3页
第3页 / 共40页
chapter 1-matlab programming for engineerszyn_第4页
第4页 / 共40页
chapter 1-matlab programming for engineerszyn_第5页
第5页 / 共40页
点击查看更多>>
资源描述

《chapter 1-matlab programming for engineerszyn》由会员分享,可在线阅读,更多相关《chapter 1-matlab programming for engineerszyn(40页珍藏版)》请在金锄头文库上搜索。

1、Matlab Programming for EngineersRoom 414, EE/AC, SYSUEmails: ynzhangieee.org, Yunong Zhang (张雨浓)http:/ is Matlab?Why do we learn Matlab?How do we learn Matlab?IntroductionA Brief History of MatlabnEngineering and scientific applications involve a lot of number crunching.nFor many years, the main lan

2、guage for this was FORTRAN - first high level programming language, and especially designed for numerical computing.nHeres a Fortran code to solve ax2 + b x + c = 0:C Solve a quadratic equation (this is a comment). DESC = B*B - 4*A*C IF ( DESC .LT. 0.0 ) GOTO 10 DESC = SQRT(DESC) X1 = (-B + DESC)/(2

3、.0*A) X2 = (-B - DESC)/(2.0*A) WRITE(6,*) SOLUTIONS ARE ,X1, AND , X2 RETURN 10 WRITE(6,*) EQUATION HAS COMPLEX ROOTS RETURNProblems using FORTRANNumber crunching on a computer can be tricky.Problems that occur are:nloss of precision and inaccurate results:X = 0.1Y = 1.0 - 10*X Y should equal 0, but

4、 probably does not! nunderflow and overflow: X = 1.0E20, X*X - too big!nefficient coding of algorithms not always obvious DO 10 N=1,100000 10 Y(N) = SQRT(2.0)*X(N) which crossC:MATLAB6p5toolboxmatlabspecfuncross.mGetting HelpnGet help in three ways in MatlabnClick Toolbar icon to start the Help Brow

5、sernType help specificfunction in Command Window help sin SIN Sine. SIN(X) is the sine of the elements of X.nType lookfor specificfunction in Command WindowGetting Help (cont.)nHelp Browser: Allow full access to the entire Matlab documentation setnhelp functionname: You must know the name of the fun

6、ction to get help about itnlookfor functionname: Search for a given string in the first comment line of every Matlab function, and display all matches help a a.m not found. lookfor aADDPATH Add directory to search path.BINPATCH Patch binary file.CD Change current working directory.CLEAR Clear variables and functions from memory.DATATIPINFO Produce a short description of a variable.DBCLEAR Remove breakpoint.DBDOWN Change local workspace context.DBSTACK Display function call stack.DBSTATUS List all the breakpoints.

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 营销创新

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号