6.094 Introduction to programming in MATLAB [教程].ppt

6.094 Introduction to programming in MATLAB [教程].ppt

  1. 1、本文档共60页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
6.094 Introduction to programming in MATLAB [教程]

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Basic Scalar Operations Arithmetic operations (+,-,*,/) 7/45 (1+i)*(2+i) 1 / 0 0 / 0 Exponentiation (^) 4^2 (3+4*j)^2 Complicated expressions, use parentheses ((2+3)*3)^0.1 Multiplication is NOT implicit given parentheses 3(1+0.7) gives an error To clear command window clc Built-in Functions MATLAB has an enormous library of built-in functions Call using parentheses – passing parameter to function sqrt(2) log(2), log10(0.23) cos(1.2), atan(-.8) exp(2+4*i) round(1.4), floor(3.3), ceil(4.23) angle(i); abs(1+i); Exercise: Scalars You will learn MATLAB at an exponential rate! Add the following to your helloWorld script: Your learning time constant is 1.5 days. Calculate the number of seconds in 1.5 days and name this variable tau This class lasts 5 days. Calculate the number of seconds in 5 days and name this variable endOfClass This equation describes your knowledge as a function of time t: How well will you know MATLAB at endOfClass? Name this variable knowledgeAtEnd. (use exp) Using the value of knowledgeAtEnd, display the phrase: Hint: to convert a number to a string, use num2str At the end of 6.094, I will know X% of Matlab Exercise: Scalars secPerDay=60*60*24; tau=1.5*secPerDay; endOfClass=5*secPerDay knowledgeAtEnd=1-exp(-endOfClass/tau); disp([At the end of 6.094, I will know ... num2str(knowledgeAtEnd*100) % of Matlab]) Transpose The transpose operators turns a column vector into a row vector and vice versa a = [1 2 3 4+i] transpose(a) a a. The gives the Hermitian-transpose, i.e. transposes and conjugates all complex numbers For vectors of real numbers . and give same result Addition and Subtraction Addition and subtraction are element-wise; sizes must match (unless one is a scalar): The following would give an error c = row + column Use the transpose to make sizes compatible c = row’ + column c = row + column’ Can sum up or multiply elements of vec

文档评论(0)

qiwqpu54 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档