matlabbook

合集下载

四款数学软件简介

四款数学软件简介

数学软件四大家Maple、MATLAB、MathCAD和Mathematica目前在科技和工程界上比较流行和著名的数学软件主要有四个,分别是MA TLAB、Maple、MathCAD和Mathematica。

它们在各自针对的目标都有不同的特色。

下面就让我为你一一道来。

一、Maple 系统Maple 是由Waterloo大学开发的数学系统软件,它不但具有精确的数值处理功能,而且具有无以伦比的符号计算功能。

Maple 的符号计算能力还是MathCAD和MATLAB等软件的符号处理的核心。

Maple提供了2000余种数学函数,涉及范围包括:普通数学、高等数学、线性代数、数论、离散数学、图形学。

它还提供了一套内置的编程语言,用户可以开发自己的应用程序,而且Maple自身的2000多种函数,基本上是用此语言开发的。

Maple采用字符行输入方式,输入时需要按照规定的格式输入,虽然与一般常见的数学格式不同,但灵活方便,也很容易理解。

输出则可以选择字符方式和图形方式,产生的图形结果可以很方便地剪贴到Windows应用程序内。

二、MATLAB 系统MATLAB原是矩阵实验室(Matrix Laboratory)在70年代用来提供Linpack和Eispack软件包的接口程序,采用C语言编写。

从80年代出现3.0的DOS版本,逐渐成为科技计算、视图交互系统和程序语言。

MATLAB可以运行在十几个操作平台上,比较常见的有基于Windows 9X/NT、OS/2、Macintosh、Sun、Unix、Linux等平台的系统。

MATLAB程序主要由主程序和各种工具包组成,其中主程序包含数百个内部核心函数,工具包则包括复杂系统仿真、信号处理工具包、系统识别工具包、优化工具包、神经网络工具包、控制系统工具包、μ分析和综合工具包、样条工具包、符号数学工具包、图像处理工具包、统计工具包等。

而且5.x版本还包含一套几十个的PDF文件,从MA TLAB的使用入门到其他专题应用均有详细的介绍。

MATLAB百科

MATLAB百科

MATLAB目录MATLAB的简介发展历程应用Matlab的优势和特点Matlab常用工具箱常用函数[编辑本段]MATLAB的简介MATLAB 是美国MathWorks公司出品的商业数学软件,用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言和交互式环境,主要包括MATLA B和Simulink两大部分。

MATLAB是矩阵实验室(Matrix Laboratory)的简称,和Mathematica、Mapl e并称为三大数学软件。

它在数学类科技应用软件中在数值计算方面首屈一指。

MAT LAB可以进行矩阵运算、绘制函数和数据、实现算法、创建用户界面、连接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。

MATLAB的基本数据单位是矩阵,它的指令表达式与数学、工程中常用的形式十分相似,故用MATLAB来解算问题要比用C,FORTRAN等语言完相同的事情简捷得多,并且mathwork也吸收了像Maple等软件的优点,使MATLAB成为一个强大的数学软件。

在新的版本中也加入了对C,FORTRAN,C++ ,JAVA的支持。

可以直接调用,用户也可以将自己编写的实用程序导入到MATLAB函数库中方便自己以后调用,此外许多的MATLAB爱好者都编写了一些经典的程序,用户可以直接进行下载就可以用。

[编辑本段]发展历程20世纪70年代,美国新墨西哥大学计算机科学系主任Cleve Moler为了减轻学生编程的负担,用FORTRAN编写了最早的MATLAB。

1984年由Little、Moler、St eve Bangert合作成立了的MathWorks公司正式把MATLAB推向市场。

到20世纪9 0年代,MATLAB已成为国际控制界的标准计算软件。

版本更新[编辑本段]应用MATLAB 产品族可以用来进行以下各种工作:● 数值分析● 数值和符号计算● 工程与科学绘图● 控制系统的设计与仿真● 数字图像处理● 数字信号处理● 通讯系统设计与仿真● 财务与金融工程MATLAB 的应用范围非常广,包括信号和图像处理、通讯、控制系统设计、测试和测量、财务建模和分析以及计算生物学等众多应用领域。

常用数学软件介绍Maple、Mathematica、Matlab、 MathCAD、 SAS、SPSS、LINDO、LINGO

常用数学软件介绍Maple、Mathematica、Matlab、 MathCAD、 SAS、SPSS、LINDO、LINGO
➢Maple 8 提供了3000余种数学函数,提供了许多专门 领域功能强大的程序包,用户可以在需要时加载。
2 、Mathematica
➢美国Wolfram Research公司开发。 ➢拥有强大的数值计算和符号计算能力(它的符号计算不 是基于Maple的,而是自己开发的)。
➢主要功能包括:符号演算、数值计算和绘图功能。 ➢基本系统主要是用C语言开发的,因而可以比较容易 地移植到各种平台上。 ➢对于输入形式有比较严格的规定,用户必须按照系统 规定的数学格式输入,系统才能正确地处理。
(5)可以方便地作出以各种方式表示的一元和二元 函数的图形,可以根据需要自由地选择画图的范围 和精确度。通过对这些图形的观察,人们可以迅速 形象地把握对应函数的某些特征。
3、 Matlab
➢Matlab是矩阵实验室(Matrix Laboratory)的缩写。 ➢是美国 MathWorks公司推出的一套高性能的数值计算 和可视化科学计算软件。 ➢它和Maple、 Mathematica并列为三大数学软件。
四种软件的比较
如果同时要求计算精度、符号计算和编程的话,最好同 时使用Maple和Mathematica ,它们在符号处理方面各具 特色。如果要求进行矩阵、图形或其他数据处理,则选 择Matlab ;同时利用Matlab的Notebook功能,结合 Word的编辑功能,可以很方便地处理科技文章。如果仅 仅是要求一般的计算或者是普通用户日常使用,首选的 是MathCAD ,它在高等数学方面所具有的能力,足够一 般用户的要求,而且它的输入界面也特别友好。
➢集数值分析、矩阵运算、信号处理和图形显示于一体。
➢Matlab以无需定义维数的矩阵作为基本数据单位。 ➢目前国内外高校和研究部门科学研究的重要工具。

MATLAB的功能及特点

MATLAB的功能及特点

MATLAB的功能及特点经过MathWorks公司的不断完善升级,MATLAB进展得越来越优秀,主要表现在:1. 数值计算功能演草纸式的数学运算和高质量、高牢靠的数值运算力量使其优于其他数值计算软件。

2. 符号计算功能在数学、应用科学和工程计算领域,经常会遇到符号计算的问题。

MATLAB通过收购MAPLE的使用权,实现了符号计算功能。

3. 数据分析和可视化功能对科学讨论和工程计算中的大量原始数据,用MATLAB分析时通常可以用图形的方式显现出来,这不仅使数据间的关系清楚明白,而且对于揭示其内在本质往往起着较大的作用。

4. 文字处理功能MATLAB Notebook为用户供应了强大的文字处理功能。

他允许用户从一个文字处理程序(Microsoft Word)访问MATLAB的数值计算和可视化结果。

MATLAB Notebook就象一个会运算的文稿,在该文件中,可以编辑文字、随时修改计算命令、随时计算并绘制图形。

这对于撰写科技报告、论文、专著的科学工与老师,以及对于演算理工科习题的广阔同学,都是特别有用的。

5. SIMULINK动态仿真功能SIMULINK是用来建模、分析和仿真各种动态系统的交互环境,供应了采纳鼠标拖放的方法建立系统框图模型的交互界面。

通过SIMULINK供应的丰富的功能块,可以快速地创建系统的模型,不需要书写一行行代码。

与其他高级程序设计语言相比较,MATLAB不但在数学语言的表达与解释方面表现出人机交互的高度全都,而且具有如下特点:1. 基于向量、数组和矩阵的高级程序设计语言。

2. 界面友好、编程效率高。

3. 高级图形和可视化数据处理力量。

4. 广泛解决各学科专业领域内简单问题的力量。

5. 拥有一个强大的仿真工具——SIMULINK。

6. 支持科学和工程计算标准的开放式、可扩充结构。

7. 跨平台兼容。

[MATLAB图书合集].Numerical.Simulation.of.Optical.Wave.

[MATLAB图书合集].Numerical.Simulation.of.Optical.Wave.

Numerical Simulation of Optical Wave PropagationWith examples in MATLAB®Library of Congress Cataloging-in-Publication DataSchmidt, Jason Daniel, 1975-Numerical simulation of optical wave propagation with examples in MATLAB / Jason D. Schmidt.p. cm. -- (Press monograph ; 199)Includes bibliographical references and index.ISBN 978-0-8194-8326-31. Optics--Mathematics.2. Wave-motion, Theory of--Mathematical models.3. MATLAB. I. Title.QC383.S36 2010535'.42015118--dc222010015089Published bySPIEP.O. Box 10Bellingham, Washington 98227-0010 USAPhone: +1 360.676.3290Fax: +1 360.647.1445Email: Books@Web: Copyright © 2010 Society of Photo-Optical Instrumentation Engineers (SPIE)All rights reserved. No part of this publication may be reproduced or distributed in any form or by any means without written permission of the publisher.The content of this book reflects the work and thoughts of the author(s).Every effort has been made to publish reliable and accurate information herein, but the publisher is not responsible for the validity of the information or for any outcomes resulting from reliance thereon.Printed in the United States of America.About the cover: 50-watt laser for generating mesospheric sodium guide stars over 90 km above the ground. In operation at the Air Force Research Laboratory's 3.5-m telescope at the Starfire Optical Range, Kirtland AFB, NM. (Robert Q. Fugate, © 2005, Albuquerque, NM).Numerical Simulation of Optical Wave PropagationWith examples in MATLAB®Jason D. SchmidtBellingham, Washington USAContentsPreface (ix)Chapter 1 Foundations of Scalar Diffraction Theory (1)1.1 Basics of Classical Electrodynamics (1)1.1.1 Sources of electric and magnetic fields (2)1.1.2 Electric and magnetic fields (2)1.2 Simple Traveling-Wave Solutions to Maxwell's Equations (5)1.2.1 Obtaining a wave equation (5)1.2.2 Simple traveling-wave fields (7)1.3 Scalar Diffraction Theory (9)12............................................................................................Problems1.4Chapter 2 Digital Fourier Transforms (15)2.1 Basics of Digital Fourier Transforms (15)2.1.1 Fourier transforms: from analytic to numerical (15)2.1.2 Inverse Fourier transforms: from analytic to numerical (17)2.1.3 Performing discrete Fourier transforms in software (18)2.2 Sampling Pure-Frequency Functions (21)2.3 Discrete vs Continuous Fourier Transforms (23)2.4 Alleviating Effects of Discretization (26)2.5 Three Case Studies in Transforming Signals (30)Sincsignals (30)2.5.12.5.2 Gaussian signals (31)2.5.3 Gaussian signals with quadratic phase (33)2.6 Two-Dimensional Discrete Fourier Transforms (35)37............................................................................................Problems2.7Chapter 3 Simple Computations Using Fourier Transforms (39)39......................................................................................Convolution3.143........................................................................................3.2Correlation3.347Functions............................................................................Structure50........................................................................................Derivatives3.43.5 Problems (53)Chapter 4 Fraunhofer Diffraction and Lenses (55)4.1 Fraunhofer Diffraction (55)4.2 Fourier-Transforming Properties of Lenses (58)4.2.1 Object against the lens (59)4.2.2 Object before the lens (59)4.2.3 Object behind the lens (61)4.3 Problems (64)Chapter 5 Imaging Systems and Aberrations (65)65........................................................................................5.1Aberrations5.1.1 Seidel aberrations (66)5.1.2 Zernike circle polynomials (66)5.1.2.1 Decomposition and mode removal (73)5.1.2.2 RMS wavefront aberration (75)5.2 Impulse Response and Transfer Function of Imaging Systems (77)5.2.1 Coherent imaging (77)5.2.2 Incoherent imaging (79)5.2.3 Strehl ratio (82)............................................................................................84Problems5.3Chapter 6 Fresnel Diffraction in Vacuum (87)6.1 Different Forms of the Fresnel Diffraction Integral (88)6.2 Operator Notation (89)6.3 Fresnel-Integral Computation (90)6.3.1 One-step propagation (90)6.3.2 Two-step propagation (92)6.4 Angular-Spectrum Propagation (95)6.5 Simple Optical Systems (102)6.6 Point Sources (107)..........................................................................................113 Problems6.7Chapter 7 Sampling Requirements for Fresnel Diffraction (115)7.1 Imposing a Band Limit (115)7.2 Propagation Geometry (117)7.3 Validity of Propagation Methods (120)7.3.1 Fresnel-integral propagation (120)7.3.1.1 One step, fixed observation-plane grid spacing (120)7.3.1.2 Avoiding aliasing (121)7.3.2 Angular-spectrum propagation (124)7.3.3 General guidelines (128)7.4 Problems (130)Chapter 8 Relaxed Sampling Constraints with PartialPropagations (133)8.1 Absorbing Boundaries (134)8.2 Two Partial Propagations (135)8.3 Arbitrary Number of Partial Propagations (138)8.4 Sampling for Multiple Partial Propagations (139)8.5 Problems (146)Chapter 9 Propagation through Atmospheric Turbulence (149)9.1 Split-Step Beam Propagation Method (149)9.2 Refractive Properties of Atmospheric Turbulence (150)9.2.1 Kolmogorov Theory of turbulence (152)9.2.2 Optical propagation through turbulence (156)9.2.3 Optical parameters of the atmosphere (157)9.2.4 Layered atmosphere model (164)9.2.5 Theory (164)9.3 Monte-Carlo Phase Screens (166)9.4 Sampling Constraints (172)9.5 Executing Properly Sampled Simulation (174)9.5.1 Determine propagation geometry and turbulenceconditions (174)9.5.2 Analyze the sampling constraints (176)9.5.3 Perform a vacuum simulation (178)9.5.4 Perform the turbulent simulations (179)9.5.5 Verify the output (180)9.6 Conclusion (182)9.7 Problems (183)Appendix A Function Definitions (185)Appendix B MATLAB Code Listings (187)References (189)Index (195)PrefaceDiffraction is a very interesting and active area of optical research.Unfortunately, analytic solutions are rare in many practical problems,particularly when optical waves propagate through randomlyfluctuating media.For many of these problems, researchers must resort to numerical solutions.Still,simulations in optical diffrac-tion are ually,these simulations take advantage of discrete Fourier transforms,which means using discretely spaced samples on afinite-sized grid. This leads to a few tradeoffs in speed and memory versus accuracy.Thus,the pa-rameters of the sampling grids must be chosen very carefully.Some people seek to fully automate those choices,but this cannot be done automatically in every case. To determine grid properties,one must carefully consider computational speed, available computer memory,the Nyquist sampling criterion,geometry,accurate representation of source apertures,and impact on the propagatedfield’s quantities of interest.This book grew out of an independent study I did while I was a doctoral student at University of Dayton.The study was directed by LtCol Matthew Goda,then a professor at the Air Force Institute of Technology(AFIT).After the independent study was over,Goda then created a course at AFIT on wave-optics simulations. When I graduated,I became a professor at AFIT while Goda moved on to a new military assignment.When I began teaching the wave-optics simulation course, there was no book written to the level of detail required for a graduate course fo-cused on wave-optics simulations and sampling requirements.The course was al-ways taught out of the professor’s notes,originally compiled by piling these notes was no small feat,and Goda did a tremendous job combining material from books on discrete Fourier transforms,optics journal articles and conference proceedings,technical reports from companies like the Optical Sciences Company and MZA Associates Corporation,and private communication with researchers.Until this book,simulations have always been an afterthought in just a few books on image processing and nonlinear optics.Clearly there was a gap between the practical knowledge required to perform wave-optics simulations and the the-oretical material covered in great Fourier-optics textbooks like those by Joseph Goodman and Jack Gaskill.I have heard professors across the U.S.talk about how they include material on simulations in their graduate Fourier-optics courses.I ap-plaud them for that effort because it is challenging to teach students both the the-ory and practical simulation of Fourier optics in one course.However,if the stu-ixdents are to become capable enough to write wave-optics simulations for thesis or dissertation research and beyond,they cannot get enough detail in a one-term Fourier-optics course.This is why AFIT has separate courses on Fourier optics and wave-optics simulations.This book is intended for graduate students in programs like physics,electrical engineering,electro-optics,or optical science.The book gives all of the relevant equations from Fourier optics,but to fully understand and appreciate the material, it is important to have a thorough understanding of Fourier optics before reading this book.I believe that part of the benefit of this book is the use of specific code examples, rather than just pseudo-code.However,the programming or scripting language for the examples needs to be one that is widely used and easy to understand by those who do not already use it.For those reasons,I have used M ATLAB in all of the examples throughout this book.It is heavily used in engineering both at universities and research institutions.Further,it is easy to read because of its simple language and because many numerical algorithms,such as discrete Fourier transforms and convolution,are part of its basic library.If I used other languages like C,C++, FORTRAN,Java,and Python,I would need to pick a particular external library of numerical routines or write my own algorithms and include them in the book.I believe that using M ATLAB in this book allows readers to focus on the wave propagation,rather than the most basic numerical algorithms like discrete Fourier transforms.Further,any user with access to the M ATLAB interpreter can execute the code examples as shown.No additional libraries need to be acquired and installed. Moreover,my examples rarely use M ATLAB’s toolboxes,relying heavily on its basic functionality.Readers should note that the code examples used throughout the book are designed for conceptual simplicity,rather than optimized for speed or memory usage.I encourage readers to rework my M ATLAB examples to achieve greater performance or even implement them in other languages.I offer my thanks and appreciation to all those who have paved the way for this work,particularly Glenn Tyler,David Fried,and Phillip Roberts at the Optical Sciences Company and Steve Coy at MZA Associates Corporation.In1982,Fried and Tyler wrote a technical report describing methods of simulating optical wave propagation and related sampling constraints.A few years later,Roberts wrote a follow-on report giving another clear,nicely detailed description of one-step,two-step,and angular spectrum propagation methods.More recently,Coy wrote a tech-nical report that gives a very nice description of the relationship between sampling requirements propagation geometry.These reports formed the beginnings of Goda’s notes and eventually this book.Also,thanks to those who answered my questions about wave-optics simula-tions while I was a student at UD and then while I taught the wave-optics simula-tion course as a professor at AFIT:Jeffrey Barchers,Troy Rhoadarmer,Terry Bren-nan,and Don Link.These gentlemen are experienced and accomplished researcherswhose advice was very much appreciated.Additionally,thanks to Michael Havrilla for his help with the basic electrodynamics in Ch.1.Special thanks to Matthew Goda for his foundational work in the course and its notes.Without him,this book would not be possible.He made much of the material in this book accessible to dozens of students who went on to do great things for the U.S.Air Force.Finally,I’d like to thank all those students who helpedfind errors in the drafts of this book and whose inquisitive nature caused me to refine and add material along the way.Jason SchmidtJune,2010Chapter1Foundations of Scalar Diffraction TheoryLight can be described by two very different approaches:classical electrodynam-ics and quantum electrodynamics.In the classical treatment,electric and magnetic fields are continuous functions of space and time,and light comprises co-oscillating electric and magnetic wavefields.In the quantum treatment,photons are elemen-tary particles with no mass nor charge,and light comprises one or more photons. There is rigorous theory behind each approach,and there is experimental evidence supporting both.Neither approach can be dismissed,which leads to the wave-particle duality of light.Generally,classical methods are used for macroscopic properties of light,while quantum methods are used for submicroscopic proper-ties of light.This book describes macroscopic properties,so it deals entirely with classi-cal electrodynamics.When the wavelengthλof an electromagnetic wave is very small,approaching zero,the waves travel in straight lines with no bending around the edges of objects.That is realm of geometric optics.However,this book treats many situations in which geometric optics are inadequate to describe observed phe-nomena like diffraction.Therefore,the starting point is classical electrodynamics with solutions provided by scalar diffraction theory.Geometric optics is treated briefly in Sec.6.5.1.1Basics of Classical ElectrodynamicsClassical electrodynamics deals with relationships between electricfields,magnetic fields,static charge,and moving charge(i.e.,current)in space and time based on the macroscopic properties of the materials in which thefields exist.We define each quantity here along with some basic relationships.This introduces the reader to the quantities in Maxwell’s equations,which describe how electrically charged particles and objects give rise to electric and magneticfields.Maxwell’s equations are introduced here in their most general form,and then the discussion focuses on a specific case and solutions for oscillating electric and magneticfields,which light comprises.12Chapter 11.1.1Sources of electric and magneticfieldsElectric charge,measured in coulombs,is a fundamental property of elementary particles and bulk materials.Classically,charge may be positive,negative,or zero. Further,charge is quantized,specifically the smallest possible nonzero amount of charge is the elementary charge e=1.602×10−19C.All nonzero amounts of charge are integer multiples of e.For bulk materials,the integer may be very large so that total charge can be treated as continuous rather than discrete.We denote the volume density of free charge,measured in coulombs per cubic meter,byρ(r,t), where r is a three-dimensional spatial vector,and t is time.Moving charge density is called free volume current density J(r,t).V olume current density is measured in Ampères per square meter(1A=1C/s).This represents the time rate at which charge passes through a surface of unit area.Finally,charge is conserved,meaning that the total charge of any system is constant.This is mathematically stated by the continuity equation=0.(1.1)∇·J(r,t)+∂ρ(r,t)∂tAlmost every material we encounter in life is composed of many,many atoms each with many positive and negative ually,the numbers of positive and negative charges are equal or nearly equal so that the whole material is electrically neutral.Still,such a material can give rise to electric or magneticfields when the to-tal charge and free current are zero.If the distribution of charge is not homogeneous or if the charges are circulating in tiny current loops,fields could be present.The separation of charge is described by the electric dipole moment,which is the amount of separated charge times the separation distance.If a bulk material has its charge arranged in many tiny dipoles,it is said to be electrically polarized.The volume polarization density P(r,t)is the density of electric dipole moments per unit volume,measured in coulombs per square meter.Magnetization is a similar concept for moving charge.Charge circulating in a tiny current loop is described by magnetic dipole moment,which is the circulat-ing current times the area of the loop.When a bulk material has internal current arranged in many tiny loops,it is said to be magnetized.The volume magnetiza-tion density M(r,t)is the density of magnetic dipole moments per unit volume, measured in Ampères per meter.1.1.2Electric and magneticfieldsWhen a hypothetical charge,called a test charge,passes near a bulk material that has non-zeroρ,J,P,or M,the charge experiences a force.This interaction is char-acterized by two vectors E and B.The electromagnetic force F on a test particle at a given point and time is a function of these vectorfields and the particle’s charge q and velocity v.The Lorentz force law describes this interaction asF=q(E+v×B).(1.2)If this empirical statement is valid(and,of course,countless experiments over the course of centuries have shown that it is),then two vectorfields E and B are thereby defined throughout space and time,and these are called the“electricfield”and “magnetic induction.”1Eq.(1.2)can be examined in a little more detail to provide more intuitive defini-tions of thesefields.The electricfield is the amount of force per unit of test charge when the test charge is stationary,given byE=limq→0+Fq v=0.(1.3)This is called a push-and-pull force because the force is in either the same or op-posite direction as thefield,depending on the sign of the charge.Electricfield is measured in units of volts per meter(1V=1N m/C).The magneticfield is related to the amount of force per unit test charge given byv×B=limq→0+F−q Eq v=0.(1.4)The force due to a magneticfield is called deflective because it is perpendicular to the particle’s velocity,which deflects its trajectory.Magneticfield is measured in units of Tesla[1T=1N s/(C m)].With this understanding of thefields,they now need to be related to the sources. This was accomplished through centuries of experimental measurements and theo-retical and intuitive insight,resulting in∇×E+∂B∂t=0(1.5)∇×B−µ0 0∂E∂t=µ0 J+∂P∂t+∇×M .(1.6)These are two of Maxwell’s equations,the former being Faraday’s law and the latter being Ampère’s law with Maxwell’s correction.In Eq.(1.6),the sources on the right hand side include the free current J and two terms due to bound currents. These are the polarization current∂P/∂t and the magnetization current∇×M.These equations can be written in a more functionally useful form.Eq.(1.6) can be rewritten as∇× Bµ0−M =J+∂∂t( 0E+P).(1.7) Making the definitionsD= 0E+P(1.8)H=Bµ0−M(1.9)Foundations of Scalar Diffraction Theory3introduces the concepts of electric displacement D and magnetic field H ,which are fields that account for the medium’s response to the applied fields.Now,the working form of these Maxwell equations becomes∇×E =−∂B∂t (1.10)∇×H =J +∂D ∂t .(1.11)Further,when these are combined with conservation of charge expressed in Eq.(1.1),this leads to∇·∇×H =∇·J +∂∂t ∇·D (1.12)=−∂ρ∂t +∂∂t∇·D (1.13)=0.(1.14)Focusing on the right-hand side,∂∂t(∇·D −ρ)=0(1.15)∇·D −ρ=f (r ),(1.16)where f (r )is an unspecified function of space but not time.Causality requires that f (r )=0before the source is turned on,yielding Coulomb’s law:∇·D =ρ.(1.17)Similar manipulations yield∇·B =0.(1.18)This indicates that magnetic monopole charges do not exist.Finally,Eqs.(1.10),(1.11),(1.17),and (1.18)constitute Maxwell’s equations.1In this model of macroscopic electrodynamics,Eqs.(1.10)and (1.11)are two independent vector equations.With three scalar components each,these are six in-dependent scalar equations.Unfortunately,given knowledge of the sources,there are four unknown vector fields D ,B ,H ,and E .Each has three scalar components for a total of twelve unknown scalars.With so many more unknown field compo-nents than equations,this is a poorly posed problem.The key is to understand the medium in which the fields exist.This produces a means of relating P to E and M to H ,which amount to six more scalar equations.For example,in simple media (linear,homogeneous,and isotropic),P = 0χe E(1.19)M =χm H ,(1.20)4Chapter 1Foundations of Scalar Diffraction Theory5 whereχe is the electric susceptibility of the medium andχm is its magnetic sus-ceptibility.Substituting these into Eqs.(1.8)and(1.9)yieldsD= 0E+P(1.21)= 0(1+χm)E(1.22)= E(1.23) andB=µ0(H+M)(1.24)=µ0(1+χm)H(1.25)=µH,(1.26) where =(1+χe) 0is the electric permittivity andµ=(1+χm)µ0is the magnetic permeability of the medium.Now,this simplifies Eqs.(1.10)and(1.11) so that∇×E=−µ∂H∂t(1.27)∇×H=J+ ∂E∂t.(1.28) Now,there are still six equations but only six unknowns(as long as the free current density J is known).Finally,with a proper understanding of the materials,this is a well posed problem.1.2Simple Traveling-Wave Solutions to Maxwell’s Equations There are many solutions to Maxwell’s equations,but there are only a few that can be written in closed form without an integral.This section begins with transforming Maxwell’s four equations into two uncoupled wave equations.It continues with a few specific simple solutions such as the infinite-extent plane wave.A more general solution is left to the next section.1.2.1Obtaining a wave equationThis book deals with optical wave propagation through linear,isotropic,homoge-neous,nondispersive,dielectric media in the absence of source charges and cur-rents.In this case,the media discussed throughout the remainder of this book have=a scalar,independent ofλ,r,t(1.29)µ=µ0(1.30)ρ=0(1.31)J=0.(1.32)Taking the curl of Eq.(1.27)yields∇×(∇×E )=−µ0∂∂t (∇×H ).(1.33)Then,substituting in Eq.(1.28)gives∇×(∇×E )=−µ0 ∂2∂t 2E .(1.34)Now,applying the vector identity ∇×(∇×E )=∇(∇·E )−∇2E leads to∇(∇·E )−∇2E =−µ0 ∂2∂t 2E .(1.35)Finally,substituting in Eqs.(1.17)and (1.23),and keeping in mind that is inde-pendent of position results in a wave differential equation:∇2E −µ0 ∂2∂t 2E =0.(1.36)Similar manipulations beginning with the curl of Eq.(1.28)yield∇2B −µ0 ∂2∂t 2B =0.(1.37)When the Laplacian is used on the Cartesian components of E and B ,the result is six uncoupled but identical equations of the form∇2−µ0 ∂2∂t2 U (x,y,z )=0,(1.38)where the scalar U (x,y,z )stands for any of the x -,y -or z -directed components of the vector fields E and B .At this point,we can define index of refraction n = 0(1.39)and the vacuum speed of light c =1√µ0 0(1.40)so that∇2−n 2c 2∂2∂t 2 U (x,y,z )=0.(1.41)The electric and magnetic fields that compose light are traveling wave fields.There-fore,fields with harmonic time dependence exp (−i 2πνt )(where νis the wave 6Chapter 1frequency)are the types of solutions sought for the purposes of this book.When this is substituted into Eq.(1.41),the result is∇2+ 2πnνc 2 U=0.(1.42) Typically,the wavelength is given byλ=c/ν,and the wavenumber is defined as k=2π/λso that ∇2+k2n2 U=0.(1.43) This is the Helmholtz equation,and it appears in many other branches of physics including thermodynamics and quantum mechanics.At this point,we can dispense with the time dependence since it is the same for all solutions of the Helmholtz equation.From this point forward,thefield U(x,y,z)refers to the phasor por-tion of the opticalfield(i.e,no time dependence).Further,we define the units of U(x,y,z)to be square-root watts per meter(1W=1J/s=1N m/s)so that optical irradiance I=|U|2is in units of watts per meter squared.The value of the electric field or magnetic induction can always be obtained by a simple conversion of units.1.2.2Simple traveling-wavefieldsThere are several simple traveling-wavefields that are useful in this book.These are planar,spherical,and Gaussian-beam waves.With each of these solutions,thefield at all points always maintains its planar,spherical,or Gaussian-beam form,and pa-rameters like radius of curvature change in a simple manner as the wave propagates. The next section on scalar diffraction theory handles more general cases.A planar wave is the simplest possible traveling wave.It has uniform amplitude and phase in any plane perpendicular to its direction of propagation.More gener-ally,when the optical axis is not along the direction of propagation,a planar wave field is given byU P(r)=A exp(i k·r),(1.44) where A is the amplitude of the wave andk=2πλ(αˆx+βˆy+γˆz)(1.45)is the wavevector with direction cosines given byα,β,andγ.Then,making the direction cosines more explicit,U P(r)=A exp i2πλ(αx+βy+γz) .(1.46)This wave travels at an angle cos−1αfrom the x-axis and cos−1βfrom the y-axis as shown in Fig.1.1.Foundations of Scalar Diffraction Theory7yzFigure 1.1Depiction of direction cosines α,β,and γ.A spherical wave is the next simplest wave field.It has a wavefront that is spherical in shape,and it is either diverging or converging.The energy of the wave is spread uniformly over a spherical surface with area given by 4πR 2,where R is the wavefront radius of curvature.Conservation of energy requires that the ampli-tude is accordingly proportional to R −1.A spherical wave is given byU S (r )=A exp [ikR (r )]R (r ).(1.47)If the center of the sphere is located at r c =(x c ,y c ,z c ),then at an observation point r =(x,y,z ),the radius of curvature is given by R (r )= (x −x c )2+(y −y c )2+(z −z c )2.(1.48)Often in optics,attention is restricted to regions of space that are very close to the optical axis.This is called the paraxial approximation,and assuming propagation in the positive z direction,this approximation is mathematically written ascos −1α 1(1.49)cos −1β 1.(1.50)With this approximation,we eliminate the square root by expanding it as a Taylor series and keeping only the first two terms,yielding R (r ) ∆z 1+12 x −x c ∆z 2+12 y −y c ∆z2 ,(1.51)where we have defined ∆z =|z −z c |.With the paraxial approximation,a spherical wave is approximatelyU S (r ) A e ik ∆z ∆z e i k 2∆z [(x −x c )2+(y −y c )2].(1.52)8Chapter 1Onefinal simple traveling wave often encountered in optics is the Gaussian-beam wave.It has a Gaussian amplitude profile and“paraxially spherical”wave-front.The full derivation of the Gaussian-beam solution invokes the paraxial ap-proximation along the way.Such a derivation can be found in common laser text-books like Refs.2–3.This solution is given byU G(r)=Aq(z)exp ik x2+y22q(z) ,(1.53)where1 q(z)=1R(z)+iλπW2(z)(1.54)and the beam radius and wavefront radius of curvature are given byW2(z)=W20 1+ λzπW20 2 (1.55)R(z)=z 1+ πW20λz 2 ,(1.56)where W0is the minimum spot radius.At any point along the z axis,W(z)is the 1/e radius of thefield amplitude.Also,by this convention,W(0)=W0so that the minimum spot radius is located at z=0.1.3Scalar Diffraction TheoryOften,the optical source is not a simple planar,spherical,nor Gaussian-beam wave. For more general cases,we must use more sophisticated means to solve the scalar Helmholtz equation.This means taking advantage of Green’s theorem with clever use of boundary conditions.This process is not discussed in detail here,but the interested reader should consult books like Refs.4–5for a detailed treatment.The geometry for this more general case is shown in Fig.1.2.In thisfigure, the coordinates are r1=(x1,y1)in the source plane and r2=(x2,y2)in the observation plane.The distance between the two planes is∆z.Thefigure illus-trates the basic problem:given the source-plane opticalfield U(x1,y1),what is the observation-planefield U(x2,y2)?The solution is given by the Fresnel diffraction integralU(x2,y2)=e ik∆ziλ∆z∞−∞∞−∞U(x1,y1)e i k2∆z[(x1−x2)2+(y1−y2)2]dx1dy1.(1.57)Note that this is not the most general solution.In fact,it is a paraxial approximation, but it is general enough and accurate enough for the purposes of this book. Foundations of Scalar Diffraction Theory9。

基于Matlab Notebook的CAI

基于Matlab Notebook的CAI
n tbo o e o k— s t p eu
然后 按照提示一 步一 步的安装就可 以了 。
来做 C 程序可 实现很复杂 的功能 , AI 但普遍存 在开发周期 长、 维护难 的问鼯 。用 多媒体软 件编写 C 程序 比起用 编程 AI 序语言 来写要简单的多 , 但效率不高 . 灵活性也不 够好 。 目前 , 大专 院校中 急需 的理 工科教学试 验用 C 需要 在 AI
表 1列 出 了这 些 选 项 和 设 置 的 含 义
设 计 一 项 产 品 。 必 须 知 道 所 使 用 工 具 的 局 限性 。 编 程 语 言 就 用
安装 N 'E OK 之前 , OI  ̄) ' 应先在 系统 中安装 Mat b . la 5O l
以 上 版本 和 M i oot od6 0或 7 0版 . 在 M A AB . c sf W r . r . TL 5 0
()NO B OK 功 能 6 TE O
瞳 1
选 中 m-b o . t - o k d 模版 , o 再选 中右下角。 文档 选项 , 确定
后将建立一个 m-bo - o k文格 . 打开一十 m—b o o k的方法 和打 开一 个普通 的 Wod文档 投什么 区别 。如果想将其 他文 格转 r 换为 m—bo o k文格 , 只要先 新建一 个 m—b o o k文 格 , 后选 然 择“ 入 插 菜单中的文件选项即可 。
版 中 . T B OK还不提供对 Mirs f Wod 7 NO E O coot r 9 的支持 , 到 了 MAT A 5 3版就可 以支持 Mi o ot r 9 。Noe L B. c sf Wod 7了 r t.
Bo ok的安装很简单 , Ma[b的命夸窗 口键入 : 在 t a

第5章 MATLAB笔记本

第5章 MATLAB笔记本

第4 页
【例5.1 】定义并执行输入单元。
操作步骤如下: (1)在文档中输入MATLAB命令(如产生。 X=magic(5) Y=inv(X); Z=X.^(-1);
(2)选中命令行,在Notebook菜单项中选Define Input Cell命令或直接按组合键Alt+D,于是命令行就变成了 “绿色”的输入单元。 (3)若要把输入单元送去执行,则可用Notebook菜单项 中的Evaluate Cell命令或直接按组合键Ctrl+Enter,执行后 产生“蓝色”的输出单元:
第10页
5.4 输出格式控制
可以通过Notebook菜单中的Notebook Options命令来实 现。选择该命令后,会弹出输出格式控制对话框,以后的 操作都是针对该对话框进行。
数据形式
空行处理
嵌入文档 图形大小
第11页
5.4.1 输出数据格式控制 1.输出数据的表示方式 用对话框或format 2.输出数据间的空行控制 Loose或Compact 5.4.2 输出图形格式控制 利用输出格式控制对话框,也可以实现对输出图形 的控制。 1.图形镶嵌的控制 2.曲面图色彩控制 3.图形背景色的控制 4.图形大小的控制
第13页
5.6 M-book模板样式的修改
同其他Word模板一样,用户既可以修改M-book模板 原有样式,也可以加入新样式。例如,现有的M-book模 板中,输入单元是绿色的,输出单元和自初始化单元是蓝 色的,错误单元是红色的。现在可以把输出单元的颜色变 为黑色。 操作步骤: 1)选取Word“格式”菜单中的“样式” 2)在“样式”列表框中选择Output,然后单击“更改” 按钮 3)选中“添至模板”复选框,再单击“格式”按钮,在 弹出栏中选“字体” 4)在字体对话框中将颜色改为黑色,单击确定。

数学软件四大家Maple、MATLAB、MathCAD和Mathematica

数学软件四大家Maple、MATLAB、MathCAD和Mathematica

数学软件四大家Maple、MATLAB、MathCAD和Mathematica目前在科技和工程界上比较流行和著名的数学软件主要有四个,分别是MATLAB、Maple、MathCAD和Mathematica。

它们在各自针对的目标都有不同的特色。

下面就让我为你一一道来。

一、Maple 系统Maple 是由Waterloo大学开发的数学系统软件,它不但具有精确的数值处理功能,而且具有无以伦比的符号计算功能。

Maple 的符号计算能力还是MathCAD和MATLAB等软件的符号处理的核心。

Maple提供了2000余种数学函数,涉及范围包括:普通数学、高等数学、线性代数、数论、离散数学、图形学。

它还提供了一套内置的编程语言,用户可以开发自己的应用程序,而且Maple自身的2000多种函数,基本上是用此语言开发的。

Maple采用字符行输入方式,输入时需要按照规定的格式输入,虽然与一般常见的数学格式不同,但灵活方便,也很容易理解。

输出则可以选择字符方式和图形方式,产生的图形结果可以很方便地剪贴到Windows应用程序内。

二、MATLAB 系统MATLAB原是矩阵实验室(Matrix Laboratory)在70年代用来提供Linpack和Eispack软件包的接口程序,采用C语言编写。

从80年代出现3.0的DOS版本,逐渐成为科技计算、视图交互系统和程序语言。

MATLAB可以运行在十几个操作平台上,比较常见的有基于Windows 9X/NT、OS/2、Macintosh、Sun、Unix、Linux等平台的系统。

MATLAB程序主要由主程序和各种工具包组成,其中主程序包含数百个内部核心函数,工具包则包括复杂系统仿真、信号处理工具包、系统识别工具包、优化工具包、神经网络工具包、控制系统工具包、μ分析和综合工具包、样条工具包、符号数学工具包、图像处理工具包、统计工具包等。

而且5.x版本还包含一套几十个的PDF文件,从MATLAB的使用入门到其他专题应用均有详细的介绍。

数学软件四大家族——Maple、MATLAB、MathCAD和Mathematica优缺点比较

数学软件四大家族——Maple、MATLAB、MathCAD和Mathematica优缺点比较

数学软件四⼤家族——Maple、MATLAB、MathCAD和Mathematica优缺点⽐较⽬录数学软件四⼤家族——Maple、MATLAB、MathCAD和Mathematica优缺点⽐较2016-11-10 20:03 ⽬前在科技和⼯程界上⽐较流⾏和著名的数学软件主要有四个,分别是Maple、MATLAB、MathCAD和Mathematica。

它们在各⾃针对的⽬标都有不同的特⾊。

Maple V 系统 Maple V是由Waterloo⼤学开发的数学系统软件,它不但具有精确的数值处理功能,⽽且具有⽆以伦⽐的符号计算功能。

Maple V的符号计算能⼒还是MathCAD和MATLAB等软件的符号处理的核⼼。

Maple提供了2000余种数学函数,涉及范围包括:普通数学、⾼等数学、线性代数、数论、离散数学、图形学。

它还提供了⼀套内置的编程语⾔,⽤户可以开发⾃⼰的应⽤程序,⽽且Maple⾃⾝的2000多种函数,基本上是⽤此语⾔开发的。

Maple采⽤字符⾏输⼊⽅式,输⼊时需要按照规定的格式输⼊,虽然与⼀般常见的数学格式不同,但灵活⽅便,也很容易理解。

输出则可以选择字符⽅式和图形⽅式,产⽣的图形结果可以很⽅便地剪贴到Windows应⽤程序内。

5个星的数学软件,纯粹数学的巨⼈,如果想做数学和应⽤数学的能⼒(数值的除外)其是最好的选择。

但是此软件⼆次开发能⼒不好,仅把软件的发展⽬标放在数学上,不想向其它领域发展。

Maple⾃带的语⾔较容易理解,就像⽤英语说话⼀样。

优势:符号计算⾮常强⼤,和Mathematica相⽐各有千秋许多多项式操作⽐Mathematica更快⼀些符号积分Maple也有速度优势(特别是不定积分),不过有时返回的结果没有Mathematica给出的更严谨、鲁棒性好,能算的积分类型没有Mathematica多Maple的“适应性”更好,有的问题Mathematica需要⼀定的预处理才能算的更快,得出满意的结果Maple更擅长(偏)微分⽅程,(其实Maple和Mathematica都能解⼀些对⽅解不了的⼀些特殊微分⽅程)可以带步骤求解⼀些问题,Mathematica需要第三⽅的Package或借助WolframAlpha上⼿较快,⼀些常见的操作⽆需命令,通过右键菜单就能完成 缺点:界⾯有点卡(基于Java swing),经典界⾯流畅但是很⼟⾃带的代数⽅⾯的package⽐较丰富化简能⼒,不等式求解,逻辑系统较Mathematica逊⾊⼀些数值计算总体上⽐Matlab和Mathematica差⼀些⾼精度和⼤数计算⽅⾯强于Matlab弱于Mathematica统计⽅⾯有些薄弱MATLAB 系统 MATLAB原是矩阵实验室(Matrix Laboratory),在70年代⽤来提供Linpack和Eispack软件包的接⼝程序,采⽤C语⾔编写。

第四讲 MATLAB的Notebook

第四讲 MATLAB的Notebook

第四讲 MATLAB 的Notebook1 Notebook简介Notebook把Matlab和Microsoft word 集成为一体,为文字处理、科学计算和数据可视化提供一个统一的环境.它利用Word进行文字处理,利用Matlab进行计算,在前台Word环境下输入Matlab命令,交给后台的Matlab运行,并将所得结果送回前台Word环境.2 Notebook安装Matlab5.3以前的版本在安装过程中需提示告知winword.exe所在的目录和template的路径Matlab5.3的版本会自动搜索所需的目录安装完后会在生成\matlab\notebok的目录,在\Microsoft Office\Template下存在两个模块文件M-book.dot也可在 Matlab的命令窗口进行设置notebook('-setup')Welcome to the utility for setting up the MATLAB Notebookfor interfacing MATLAB to Microsoft WordChoose your version of Microsoft Word:[1] Microsoft Word for Windows 95 (Version 7.0)[2] Microsoft Word 97[3] Microsoft Word 2000[4] Exit, making no changesMicrosoft Word Version: 3You will be presented with a dialog box. Please use it to selectyour copy of the Microsoft Word 2000 executable (winword.exe).Press any key to continue...You will be presented with a dialog box. Please use it toselect a Microsoft Word template (.dot) file in one of yourMicrosoft Word template directories. We suggest that you specifyyour normal.dot file.Press any key to continue...Notebook setup is complete.在Windows 2000 or XP下,MATLAB6.5的Notebook的设置比较简单notebook -setupWelcome to the utility for setting up the MATLAB Notebookfor interfacing MATLAB to Microsoft WordChoose your version of Microsoft Word:[1] Microsoft Word 97[2] Microsoft Word 2000[3] Microsoft Word 2002 (XP)[4] Exit, making no changesMicrosoft Word Version: 2Notebook setup is complete.在Windows XP下,MATLAB7.01的Notebook的设置>> notebook -setupWelcome to the utility for setting up the MATLAB Notebookfor interfacing MATLAB to Microsoft WordChoose your version of Microsoft Word:[1] Microsoft Word 97[2] Microsoft Word 2000[3] Microsoft Word 2002 (XP)[4] Microsoft Word 2003 (XP)[5] Exit, making no changesMicrosoft Word Version: 2Notebook setup is complete.在Windows XP下,MATLAB7.10的Notebook的设置(Word2003)>> notebook -setupWelcome to the utility for setting up the MATLAB Notebookfor interfacing MATLAB to Microsoft WordSetup complete3 启动notebook两种启动方式:一是在MATLAB Command窗口运行notebook,另一种在Windows下启动word file菜单新建 M-book.dot4 Notebook的菜单定义输入细胞定义自初始化细胞定义计算区将细胞转换成文本删除M-book 文件中的所有输出细胞定义细胞群将细胞群转换为单细胞隐藏细胞标志输出细胞嵌入图形运行当前细胞或细胞群运行当前计算区运行M-BOOK中所有的细胞循环运行细胞将MATLAB从后台送到前台Noebook参数设置5 Notebook基本使用方法5.1 文档输入5.2MATLAB命令的输入、运行和输出* 输入合法的MATLAB的命令和注系的文本* 通过命令define input cell 将其定义为输入细胞define autoint cell将其定义为自活细胞(启动M-BOOK时能自动送去运算) * 运行输入细胞和自活细胞* 其结果为输出细胞,包括数据、图形和错误A=[1,2,3;4,5,6;7,8,0],inv(A)A = 1 2 34 5 67 8 0ans =-1.7778 0.8889 -0.11111.5556 -0.7778 0.2222-0.1111 0.2222 -0.1111A=[9,2,3;4,5,6;7,8,0],B=fliplr(A)A =9 2 34 5 67 8 0B =3 2 96 5 40 8 75.3 细胞群及其作用细胞群:多行输入细胞或自活细胞组成一个整体用途:为保证MATLAB命令结构(如循环结构、条件结构)的完整,必须使用细胞群为保证输出结果(如图形)的完整,必须使用细胞群clear Array x=0:10;for k=1:10plot(x,y)hold onendhold offclearclft=0:pi/100:2*pi;x=sin(t);y=cos(t);plot(t,x)hold onplot(t,y)5.4 计算区及作用计算区:由一个由文本、输入细胞和输出细胞组成的连续区,用于描述某个具体作业或问题其定义和执行是define calc zoneEvaluate calc zone5.5 细胞文本化及目的细胞文本化是将输入细胞或细胞群,通过undefine cells命令转化为文本目的是切断了与输出细胞的联系,不会因为输入细胞的改变而改变5.6 Notebook的参数设置主要指数据输出格式和图形输出参数的设置6 注意事项* 工作空间初始化(用clear清除内存的变量和函数,防止相互干扰)* MATLAB指令必须在英文状态下输入,包括标点符号* Notebook与中文Word的冲突M-book.dot属于英文模板,可以通过菜单“格式”“样式和格式”“新样式”“格式”“字体”将英文模板变为具备中文处理能力的中文M-book.dot,最后保存该模板。

The MATLAB Notebook

The MATLAB Notebook

数组数组的生成冒泡法生成x1=1:pix2=0:0.5:pix3=pi:-0.5:0x1 =1 2 3x2 =0 0.5000 1.0000 1.5000 2.0000 2.5000 3.0000 x3 =3.1416 2.6416 2.1416 1.6416 1.1416 0.6416 0.1416利用linspace( )指令生成一维数组y1=linspace(0,8,5)y2=linspace(pi,0,6)y1 =0 2 4 6 8y2 =3.1416 2.5133 1.8850 1.2566 0.6283 0二维数组创建d=eye(3)a=6*ones(4,4)c=diag(diag(a))d =1 0 00 1 00 0 1a =6 6 6 66 6 6 66 6 6 66 6 6 6c =6 0 0 00 6 0 00 0 6 00 0 0 6数值数组的寻访一维数组的寻访x=[2.0000 1.0365 1.7895 3.0000+20000i]x1=x(3)x2=x([1 2 4])x3=x(2:end)x4=x(4:-1:1)x =1.0e+004 *0.0002 0.0001 0.0002 0.0003 + 2.0000ix1 =1.7895x2 =1.0e+004 *0.0002 0.0001 0.0003 + 2.0000ix3 =1.0e+004 *0.0001 0.0002 0.0003 + 2.0000ix4 =1.0e+004 *0.0003 + 2.0000i 0.0002 0.0001 0.0002二维数组的寻访A=rand(3,5)A1=A(1,:)A2=A(1:2,2:5)A3=A([1,3],[2,5])A =0.9501 0.4860 0.4565 0.4447 0.92180.2311 0.8913 0.0185 0.6154 0.73820.6068 0.7621 0.8214 0.7919 0.1763A1 =0.9501 0.4860 0.4565 0.4447 0.9218A2 =0.4860 0.4565 0.4447 0.92180.8913 0.0185 0.6154 0.7382A3 =0.4860 0.92180.7621 0.1763数组与矩阵运算比较A=[-1,-2,-3;-4,-5,-6;-7,-8,-9]B=[1,2,3;4,5,6;7,8,9]C=A+B*iCN=C.'CM=C'ABN=A.*BABM=A*BA =-1 -2 -3-4 -5 -6-7 -8 -9B =1 2 34 5 67 8 9C =-1.0000 + 1.0000i -2.0000 + 2.0000i -3.0000 + 3.0000i-4.0000 + 4.0000i -5.0000 + 5.0000i -6.0000 + 6.0000i-7.0000 + 7.0000i -8.0000 + 8.0000i -9.0000 + 9.0000iCN =-1.0000 + 1.0000i -4.0000 + 4.0000i -7.0000 + 7.0000i-2.0000 + 2.0000i -5.0000 + 5.0000i -8.0000 + 8.0000i-3.0000 + 3.0000i -6.0000 + 6.0000i -9.0000 + 9.0000iCM =-1.0000 - 1.0000i -4.0000 - 4.0000i -7.0000 - 7.0000i-2.0000 - 2.0000i -5.0000 - 5.0000i -8.0000 - 8.0000i-3.0000 - 3.0000i -6.0000 - 6.0000i -9.0000 - 9.0000i ABN =-1 -4 -9-16 -25 -36-49 -64 -81ABM =-30 -36 -42-66 -81 -96-102 -126 -150数组的关系运算和逻辑运算数组的关系运算A=1:9,B=10-A,r0=(A<4),r1=(A==B),r2=(A>B)A =1 2 3 4 5 6 7 8 9B =9 8 7 6 5 4 3 2 1r0 =1 1 1 0 0 0 0 0 0r1 =0 0 0 0 1 0 0 0 0r2 =0 0 0 0 0 1 1 1 1数组的逻辑运算A=[0,2,3,4;1,3,5,0];B=[1,0,5,3;1,5,0,5]C=A&BD=A|BE=~AB =1 0 5 31 5 0 5C =0 0 1 11 1 0 0D =1 1 1 11 1 1 1E =1 0 0 00 0 0 1字符串数组创建a='sumsption',b='学院'a =sumsptionb =学院size(a)ans =1 9b=a(end:-1:1)b =noitpsmusA='机械电子工程',size(A)A =机械电子工程ans =1 6B='''机械电子工程''',size(B)B ='机械电子工程'ans =1 8B=[A,'研究院']B =机械电子工程研究院串转换函数a=rand(2,2),b='example'c=abs(b)d=char(c)e=num2str(a)a =0.4057 0.91690.9355 0.4103b =examplec =101 120 97 109 112 108 101d =examplee =0.40571 0.91690.93547 0.41027|构架数组student_rec.number=1;student_='Alan Shearer';student_rec.height=180;student_rec.test=[100,80,75;77,60,92;67,28,90;100,89,78]; student_recstudent_rec.teststudent_rec =number: 1name: 'Alan Shearer'height: 180test: [4x3 double]ans =100 80 75 77 60 92 67 28 90 100 89 78 t=(0:pi/50:2*pi)'; k=0.4:0.1:1;X=cos(t)*k;plot(X)t=(0:pi/50:2*pi)'; k=0.4:0.1:1;X=cos(t)*k;plot(t,X)t=(0:pi/100:pi)';y1=sin(t)*[1,-1];y2=sin(t).*sin(9*t);plot(t,y1,'m:',t,y2,'g')t=(0:pi/100:pi)';y2=sin(t).*sin(9*t);t1=pi*(0:9)/9;y3=sin(t1).*sin(9*t1);plot(t,y2,'b',t1,y3,'bp')t=0:0.01:pi;B=[1,3]';w=[2,5]';y=sin(w*t).*exp(-B*t);plot(t,y(1,:),'-.',t,y(2,:)) legend('w=2,B=1,','w=5,B=3') xlabel('t'),ylabel('y')title('y=sin(wt)*exp(-Bt)')t=0:0.02:3;xi=0.5;wn=5;sxi=sqrt(1-xi^2);sita=atan(sxi/xi);wd=wn*sxi;y1=1-exp(-xi*wn*t).*sin(wd*t+sita)/sxi;y2=wn*exp(-xi*wn*t).*sin(wd*t)/sxi;plotyy(t,y1,t,y2)t=(pi*(0:1000)/1000)';y1=sin(t);y2=sin(10*t);y12=sin(t).*sin(10*t); subplot(2,2,1),plot(t,y1);axis([0,pi,-1,1])subplot(2,2,2),plot(t,y2);axis([0,pi,-1,1])subplot('position',[0.2,0.05,0.6,0.45])plot(t,y12,'b-',t,[y1,-y1],'r:');axis([0,pi,-1,1])ezplot('x^2+x*y+y^2-10') axis([-4,4,-4,4])x=-4:4;y=x;[X,Y]=meshgrid(x,y);Z=X.^2+Y.^2;subplot(1,3,1),surf(X,Y,Z);subplot(1,3,2),mesh(X,Y,Z);subplot(1,3,3),plot3(x,y,x.^2+y.^2);box onclf[x,y]=meshgrid(-3:0.1:3,-2:0.1:2);z=(x.^2+2*x).*exp(-x.^2-y.^2-x.*y);subplot(1,2,1),mesh(x,y,z),axis([-3,3,-2,2,-0.5,1.0])title('透视')hidden offsubplot(1,2,2),mesh(x,y,z)title('消隐')hidden onaxis([-3,3,-2,2,-0.5,1.0])t=(0:0.02:2)*pi;x=sin(t);y=cos(t);z=cos(2*t);subplot(1,2,1),plot3(x,y,z,'b-',x,y,z,'bd') view([-82,58])title('视点控制'),box onsubplot(1,2,2),plot(x,y,z,'b-',x,y,z,'bd') box on,title('无视点控制')??? Error using plotString argument is an unknown option.subplot(1,3,1),surf(peaks),alpha(0) title('完全透明')colormap(summer);subplot(1,3,2),surf(peaks),alpha(0.5) title('半透明')colormap(summer)subplot(1,3,3),surf(peaks),alpha(1) title('完全不透明')colormap(summer)clf[x,y]=meshgrid(-3:0.1:3,-2:0.1:2);z=(x.^2-1.4*x).*exp(-x.^2-y.^2+x.*y);figure(1)surf(x,y,z),axis([-3,3,-2,2,-0.5,1.0])title('shading flat'),shading flatfigure(2)surf(x,y,z),axis([-3,3,-2,2,-0.5,1.0])title('shading interp'),shading interpfigure(3)surf(x,y,z),axis([-3,3,-2,2,-0.5,1.0])title('shading facted'),shading facted??? Error using shading (line 106)Shading methods are flat, faceted, and interp.clfezsurf('x.^2+y.^2',[-10,10],100) shading flatclf;t=[0:0.1:18]';for x=0.2:0.2:0.8b=sqrt([1-x^2]);z=atan(b/x);y1=-t*x;y2=t*b+z;y=1-exp(y1).*sin(y2)/b;plot(x,y),hold onenda(1)=1;a(2)=1;i=2;while a(i)<=10000a(i+1)=a(i-1)+a(i);i=i+1;end;i,a(i)i =21ans =10946t=[0:0.1:18]';for x=0.2:0.2:0.8b=sqrt([1-x^2]);z=atan(b/x);y1=-t*x;y2=t*b+z;y=1-exp(y1).*sin(y2)/b; switch round(10*x)case 2plot(t,y,'r-'),hold oncase 4plot(t,y,'b*'),holdcase 6plot(t,y,'k.'),hold onotherwiseplot(t,y,'g+'),hold onendendxlabel('t(秒)'),ylabel('y'),title('二阶系统阶跃响应')legend('{\xi}=0.2','{\xi}=0.4','{\xi}=0.6','{\xi}=0.8')Current plot releasedWarning: Ignoring extra legend entries.clear,N=4;A=magic(3);tryA_N=A(N,:)catchA_end=A(end,:)endlasterrA_end =4 9 2ans =Index exceeds matrix dimensions.figure(1)sa=circle(10,'y')figure(2)circle(10,'k')??? Undefined function 'circle' for input arguments of type 'double'.function y1=mainfun(a,s)t=(0:a)/a*2*pi;y1=subfun(4,s);function y2=subfun(a,s)t=(0:a)/a*2*pi;ss='a*exp(i*t)';switch scase {'base','caller'}y2=evalin(s,ss);case'self'y2=eval(ss);endcleara=30;t=(0:a)/a*2*pi;sss={'base','caller','self'};for k=1:3y0=mainfun(8,sss {k});subplot(1,3,k)plot(real(y0),imag(y0),'r','lineWidth',3)axis squareend??? Undefined function 'mainfun' for input arguments of type 'double'. t=pi;evel('theta=t/2,y1=sin(theta)');??? Undefined function 'evel' for input arguments of type 'char'.。

四种软件的比较(Maple,Matlab,Mathematic,MathCAD)

四种软件的比较(Maple,Matlab,Mathematic,MathCAD)

选用何种数学软件?如果仅仅是要求一般的计算或者是普通用户日常使用,首选的是MathCAD,它在高等数学方面所具有的能力,足够一般客户的要求,而且它的输入界面也特别友好。

如果要求计算精度、符号计算和编程方面的话,最好同时使用Maple和Mathematica,它们在符号处理方面各具特色,有些Maple不能处理的,Mathematica却能处理,诸如某些积分、求极限等方面,这些都是比较特殊的。

如果要求进行矩阵方面或图形方面的处理,则选择MATLAB,它的矩阵计算和图形处理方面则是它的强项,同时利用MATLAB的NoteBook功能,结合Word6.0/7.0的编辑功能,可以很方便地处理科技文章。

MATLAB是一套高性能的数值计算和可视化软件,最初主要用于方便矩阵的存取,其基本元素是无需定义维数的矩阵。

经过十几年的完善和扩充,现在已发展成为线性代数课程的标准工具,也成为其它许多领域课程的使用工具。

在工业环境中,可用来解决实际的工程和数学问题,其典型应用有:通用的数值计算,算法设计,各种学科如自动控制、数字信号处理、统计信号处理等领域的专门问题求解。

MATLAB集数值分析、矩阵运算、信号处理和图形显示于一体,构成了一个方便的、界面友好的用户环境。

在这个环境下,对所要求解的问题,用户只需简单地列出数学表达式、其结果便以人们十分熟悉的数值或图形方式显示出来。

MATLAB语言易学易用,不要求用户有高深的数学和程序语言知识,不需要用户深刻了解算法及编程技巧。

MATLAB既是一种编程环境,又是一种程序设计语言。

这种语言与C、FORTRAN等语言一样,有其内定的规则,但MATLAB的规则更接近数学表示。

使用更为简便,可使用户大大节约设计时间,提高设计质量。

Mathematica是一个集成化的计算机软件系统,它的主要功能包括三个方面:符号演算、数值计算和图形。

可以完成许多符号演算的数值计算的工作,如:各种多项式的计算、有理式的计算。

Matlab学习笔记6:Notebook使用简介

Matlab学习笔记6:Notebook使用简介

Matlab的Notebook使用简介一、N otebook的安装需要注意,Win7&8 64bit系统下启动Notebook后提示红色字体错误,可按以下方法修复:将提示出现的红色部分字体如下:Private Declare Function WinHelp Lib "USER32.DLL" Alias "WinHelpA" (ByVal hWnd As Integer, ByVal lpHelpFile _As String, ByVal wCmd As Integer, ByVal dwData As String) As IntegerPrivate Declare Function GetActiveWindow Lib "USER32.DLL" () As Integer替换改为如下:Private Declare PtrSafe Function WinHelp Lib "USER32.DLL" Alias "WinHelpA"(ByVal hWnd As Integer, ByVal lpHelpFile _As String, ByVal wCmd As Integer, ByVal dwData As String) As IntegerPrivate Declare PtrSafe Function GetActiveWindow Lib "USER32.DLL" () As Integer然后保存下重启notebook即可二、Notebook的基本操作1.光标放到哪一行就对哪一行语句进行执行操作2.绿色为输入单元;蓝色为输出单元3.Alt+D:定义输入单元;4.Ctrl+Enter:执行计算;a=[1 2 3 4 5]; (已经自动初始化)b=[1 2 3 4 5];bb =1 2 3 4 5c=a+bc =2 4 6 8 105.还可以直接绘图如下:plot(a,b)二、定义自动初始化单元打开notebook之后,自动执行的初始化语句:“Define AutoInit Cell”,为蓝色加粗字体。

MATLAB如何使用-教程-初步入门大全资料

MATLAB如何使用-教程-初步入门大全资料

运算 数学表达式
加 a+b

a-b
乘 a×b
除 a÷ b
幂 a^b
MATLAB运算符
+ *
/(右除)或\(左除)
^
MATLAB表达式
a+b a-b a*b a/b或b\a a^b
示例
1+2 5-3 2*3
6/2或2\6 2^3
指出:右除相当于通常的除法。
22
七、MATLAB的变量与函数
1、变量 变量就是在程序的运行过程中,其数值可以变化的量
MATLAB是交互式的语言,输入命令即给出运算结 果。而命令窗口则是MATLAB的主要交互窗口,用 于输入和编辑命令行等信息,显示结果(图形除 外)。
当命令窗口中出现提示符“>>”时,表示MATLAB已 经准备好,可以输入命令、变量或运行函数。提示 符总是位于行首。
在每个指令行输入后要按回车键,才能使指令被 MATLAB执行。
28
矩阵的创建(续)
1、直接输入法-在命令窗口按规则输入方式创建矩阵
例1.在命令窗口创建简单的数值矩阵。
>>A=[1 3 2;3 1 0;2 1 5] 回车后在命令窗口显示如下结果
A=
132
310
215 例2.在命令窗口创建带运算表达式的矩阵,不显示结果。
>>y=[sin(pi/3),cos(pi/6);log(20),exp(2)]; 输入“y”回车,在命令窗口显示出来。
(3)在MATLAB安装目录\MATLAB6p5中双击 MATLAB快捷方式。
(4)在MATLAB安装目录\MATLAB6p5\bin\win32 中双击MATLAB.exe图标。

MbookMATLAB8

MbookMATLAB8

第8章MATLAB高级应用8.1 MATLAB应用接口8.1.1 MEX文件MEX文件具有以下几个方面的应用:(1) 对于已存在的C或FORTRAN子程序,可以通过MEX文件在MATLAB环境中直接调用,而不必重新编写M文件。

(2) 由于MATLAB是解释性语言,运行如for等循环体时,会出现速度十分缓慢的现象,为了能提高速度,往往要使用MEX程序。

(3) 对于A/D、D/A卡,或其它PC硬件,可以直接用MEX文件进行访问。

(4) 利用MEX文件,可以使用如Windows用户图形界面等资源。

1. MEX文件系统设置下面采用Microsoft Visual C/C++ 6.0编译器,在命令窗口使用“mex -setup”命令,对MEX文件编译器进行配置:>> mex -setup则会出现如下提示:Please choose your compiler for building external interface (MEX) files:Would you like mex to locate installed compilers [y]/n? y让用户选择是否同意mex命令自动定位已经安装的编译器,输入“y”后,回车出现如下提示:Select a compiler:[1] Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio[2] Lcc C version 2.4 in D:\MATLAB6P1\sys\lcc[3] Microsoft Visual C/C++ version 6.0 in D:\Program Files\Microsoft Visual Studio[0] None提供用户选择编译器作为默认的MEX文件编译器,通过键盘输入“3”后,回车出现如下提示:Please verify your choices:Compiler: Microsoft Visual C/C++ 6.0Location: D:\Program Files\Microsoft Visual StudioAre these correct?([y]/n):确认所选择的编译器,通过键盘输入“y”后,回车出现如下提示:The default options file:"D:\Documents and Settings\ZJDCY\Application Data\MathWorks\MATLAB\R12\mexopts.bat"is being updated from D:\MATLAB6P1\BIN\WIN32\mexopts\msvc60opts.bat...Installing the MA TLAB Visual Studio add-in ...Updated D:\Program Files\Microsoft Visual Studio\common\msdev98\template\MATLABWizard.awx from D:\MATLAB6P1\BIN\WIN32\MA TLABWizard.awxUpdated D:\Program Files\Microsoft Visual Studio\common\msdev98\template\MATLABWizard.hlp from D:\MATLAB6P1\BIN\WIN32\MA TLABWizard.hlpUpdated D:\Program Files\Microsoft Visual Studio\common\msdev98\addins\MATLABAddin.dllfrom D:\MATLAB6P1\BIN\WIN32\MA TLABAddin.dllMerged D:\MA TLAB6P1\BIN\WIN32\usertype.datwith D:\Program Files\Microsoft Visual Studio\common\msdev98\bin\usertype.dat则表示编译器成功配置。

MATLAB软件中Notebook的使用及其技巧

MATLAB软件中Notebook的使用及其技巧

( )M—ok文档 能 “ 3 bo 无缝 ”地 与 P w ron、 o epit Atr r uh wa o e等应用 软件相链 , 使计算 机演讲不 仅使听 讲者看到 事编排 的 “ N tbo o ok安装结 束 。 e
【】 c sfW od 7 1M r o i o t r 9 【】 c sfW o 2 0 2M r o i o t d r 00 【】 c sfW o 0 ( P 3 Mi o ot r 2 2 X ) r d 0
上教材不仅图文并茂 , 且动静结合。 那些 由MA L B TA 指令构成的例题、演示,都可以供读者亲 自 操作,举
N tb o oeo k在使用中 的一 些技巧 ,非常具有实际意义 ,具有很好 的推 广价值 。
关键 词 :N t ok o bo :使用:技巧 e
1引言
随着 MAT A L B软件 的应用 范围越来 越广 ,我 们
希 望这 个 软件 能 与 WOR 文字 处 理软 件 能无 缝 结 D
( )启 动 MAT AB,打 开 MA L B指 令窗 。 2 L TA ( )在 指令窗 中运行 nt o k—e p 3 o bo st ,于 是 出 e u
现 如下提示 :
W ec me t t ui t f r e t g p h e lo o he tiy o s ti u t M ATLAB l n No b ok e t o f ri e f cn ATLAB oM ir of W o d o ntra ig M t cos t r
( )在科技报告、论文、著作和讲义教材的撰 1
写过程 中,为作者营 造 了文字 语言思 维和科学 计算思
维的和谐氛 围。 ( )用 M-o k写成 的电子著作 、电子讲义 、网 2 bo

Matlab中notebook的使用

Matlab中notebook的使用

3.M-book模板的基本操作
凡参与word和MATLAB之间交换信息的部分, 就称为“细胞(群)(Cells or Cell group)。” “输入”细胞(Input cells): 由M-book送向MATLAB的指令 “输出细胞(Output cells)”: 由MATLAB返回M-book的计算结果
三、M-book模板的使用
1.M-book模板的特点
其外形和使用方法几乎与普通word模 板完全相同,但它为用户提供了在word环 境下使用MATLAB的功能。 它是以MATLAB为其计算服务器,其特 殊功能都集中地反映在{notebook}下列菜 单中。
2.两者在界面上的区别:
在菜单栏中多了一个{notebook}菜单项。 它用于完成模板与MATAB之间的交互通讯 在{文件}菜单项下多了一个New M-book 命令。如果要建立新的M-book文档,可以 选择该命令。
4. Notebook其他菜单的介绍
自初始化细胞(Define AutoInit Cell)
可以把文本形式的MATLAB指令或已经存 在的输入细胞定义为自初始化细胞。 它与输入细胞的区别就是:当用户启动 一个M-book文件时,包含在该文件中的自 初始化细胞会自动被送去计算,而输入细 胞不具备这种功能。
定义输入细胞(Define Input Cell)
用鼠标选中(点亮)文本内容,而后 选择Notebook|Define Input Cell 按下组合键[Alt+D] 那么,“点亮”部分就被激活成输入细胞, 文字颜色将呈现为绿色。 但它并不进行运算,不会输出任何结果。
输入细胞的执行(Evaluate Cell)
删去M-book文档中所有输出细胞 {Purge Output Cells}:删去M-book文 件中所有的输出细胞。 细胞转化为文本形式(Undefine Cells) 隐藏细胞标志(Hide Cell Makers) 对输入细胞循环求值(Evaluate Loop)

MATLAB中文手册

MATLAB中文手册

MATLAB中文手册第1章MATLAB 6.5环境1.1MATLAB简介MATLAB(Matrix Laborator)是MathWorks公司开发科学与工程计算软件;广泛应用于自动控制、数学运算、信号分析、计算机技术、图像信号处理、财务分析、航天工业、汽车工业、生物医学工程、语音处理和雷达工程等行业;国内外高校和研究部门科学研究的重要工具;MATLIB 已成为数学计算工具方面事实上的标准,MATLIB 6.5是最新版本。

1.1.1 MATLAB工具箱MATLAB由基本部分和功能各异的工具箱组成。

基本部分是MATLAB的核心,工具箱是扩展部分。

工具箱是用MATLAB的基本语句编成的各种子程序集,用于解决某一方面的专门问题或实现某一类的新算法。

MATLAB有以下主要的工具箱:控制系统工具箱(Control System Toolbox)系统辨识工具箱(System Identification Toolbox)信号处理工具箱(Signal Processing Toolbox)神经网络工具箱(Neural Network Toolbox)模糊逻辑控制工具箱(Fuzzy Logic Toolbox)小波工具箱(Wavelet Toolbox)模型预测控制工具箱(Model Predictive Control Toolbox)通信工具箱(Communication Toolbox)图像处理工具箱(Image Processing T oolbox)频域系统辨识工具箱(Frequency System Identification Toolbox) 优化工具箱(Optimization Toolbox)偏微分方程工具箱(Partial Differential Equation Toolbox)财政金融工具箱(Financial Toolbox)统计工具箱(Statistics Toolbox)1.1.2 MATLAB功能和特点1.功能强大(1) 运算功能强大MATLAB的数值运算要素不是单个数据,而是矩阵,每个元素都可看作复数,运算包括加、减、乘、除、函数运算等;通过MATLAB的符号工具箱,可以解决在数学、应用科学和工程计算领域中常常遇到的符号计算问题。

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . 1
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . .
4 图形的绘制与处理 4.1 二维图形绘制 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 三维图形绘制 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 线性代数问题的求解 5.1 特殊矩阵的输入 5.2 基本矩阵分析 . 5.3 矩阵的基本变换 5.4 矩阵方程的求解 5.5 矩阵函数 . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
Matlab程序设计讲义
黄晓理 辽宁师范大学物理与电子技术学院 June 19, 2013


3 3 5 5 6 6 8 8 9 9 9 9 10 12 14 15 15 17 17 17 18 25 25 27 31 31 32 33 34 35
1 Matlab语 言 基础 1.1 基本运算功能 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 基本数据类型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 数学函数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 基本数值运算 2.1 矩阵 . . 2.2 向量 . . 2.3 数组 . . 2.4 多项式 .
. . . . . . . . . . . .
. . . . . . . . . . . .
2
引言: Matlab简 介
1.全称:Matrix Laboratory 矩阵实验室隶属于MathWorks公司 2. 基本特点: o 强大的数值计算功能 o 强大的图像处理功能 o 高级但简单的程序环境 o 丰富的工具箱与模块集 o 易于扩充 3. Matlab操作界面介绍(Matlab 7.0.x版) v 主窗口及相关按钮 v 命令窗口Command Window v 历史窗口Command History v 当前目录Current Directory v 工作区Workspace 4. 帮助功能 help: 查询指令 lookfor: 查询所有相关主题 例如:help cos 与lookfor cos 在线帮助功能: 官方网站 MathWorks公司中国代理北京恒润公司 研学论坛科技综合交流区 本课程主要参考书: 入门级参考书:任意 数学应用类参考书: 《高等应用数学问题的Matlab求解》,薛定宇,陈阳泉著,清华大学出版社 《数学物理方程的Matlab解法与可视化》,彭芳麟著,清华大学出版社 图像处理类 《Matlab数字图像处理》,张德丰著,机械工业出版社
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
1
1.1
Matlab语 言 基 础
基本运算功能
1.算术运算 运算 加 乘 左除 右除 幂次方 符号 + * \ / ^ 运算 减 数组相乘 数组左除 数组右除 数组幂次 符号 .* .\ ./ .^
说明: ★ 表达式从左向右运行,幂次方的优先级最高,乘除次之,最后是加减。若有括号,则 括号的优先级最高。 3
. . . . .
. . . . .
. . . . .
6 微积分问题的求解 6.1 数值微分 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 数值积分 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 微分方程的求解 7.1 一阶常微分方程组的数值解 . . . . . . . . . . . . . . . . . 7.1.1 四阶五级Runge-Kutta-Felhberg算法的Matlab实现 7.1.2 微分方程的转换 . . . . . . . . . . . . . . . . . . . 7.2 特殊常微分方程的数值解 . . . . . . . . . . . . . . . . . . 7.2.1 刚性微分方程 . . . . . . . . . . . . . . . . . . . . . 7.2.2 隐式微分方程求解 . . . . . . . . . . . . . . . . . . 7.2.3 微分代数方程求解 . . . . . . . . . . . . . . . . . . 7.3 偏微分方程求解入门 . . . . . . . . . . . . . . . . . . . . . 7.4 偏微分方程工具箱简介 . . . . . . . . . . . . . . . . . . . . 8 符号运算功能 8.1 符号运算简介 . . . . . . . 8.2 微积分问题的解析解 . . . 8.2.1 极限问题的解析解 8.2.2 导数问题的解析解 8.2.3 积分问题的解析解 8.3 级数问题 . . . . . . . . . 8.3.1 Taylor级数 . . . . 8.3.2 级数求和 . . . . . 8.4 复变函数与积分变换 . . . 8.4.1 Laplace变换 . . . . 8.4.2 Fourier变换 . . . . 8.5 微分方程的解析解 . . . . 9 图像文件的读写与处理简介
★ 如果未指定变量存储运算结果,系统自动将结果存储在默认暂时存储变量ans中。 ★ 指令后为逗号,运行后显示运行结果;若为分号,则不显示计算结果。 ★ 在任意命令后可加注释。注释由%引导,注释对运行结果不产生任何影响。 ★ 若命令过长可以行尾加三个句点(...)表示分行输入。 例1-1:计算[12 + 2 × (7 − 4)]/33 。 >> (12+2*(7-4))/3^3 2. 输出显示形式format命令 Matlab命令 format short format short e format long format long e format rat format bank 含义 短格式 短格式科学格式 长格式 长格式科学格式 有理格式 银行格式 范例 3.1416 3.1416e+000 3.141592653589793 3.141592653589793e+000 355/113 3.14
. . . . . . . . . . . .
. . . . . . . . . . . .
相关文档
最新文档