150 likes | 361 Views
Al Imam Mohammad Bin Saud Islamic University College of Sciences Department of Mathematics. MATLAB 251 : MATH SOFTWARE Introduction to MATLAB. mrs. Asra Sultana. Introduction to MATLAB Basics on MATLAB. Aims 1. To present the software 2. To introduce elementary operations
E N D
Al Imam Mohammad Bin Saud Islamic University College of SciencesDepartment of Mathematics MATLAB 251 : MATH SOFTWARE Introduction to MATLAB mrs.Asra Sultana
Introduction to MATLABBasics on MATLAB Aims 1. To present the software 2. To introduce elementary operations and functions. 3. To manipulate 2D and 3D graphics. 4. To introduce the notion of “files” and “programming”.
Introduction to Matlab 1. First Steps in MATLAB 1.1 What is MATLAB MATLAB (MATrixLABoratory) is a very powerful and interactive software package optimized for scientific computation and, in Manipulation.particular, matrices With MATLAB we can Ø do mathematics and computation, Ø analyze data, Ø develop algorithms, Ø do simulation and modeling, Ø produce graphical displays and graphical user interfaces.
MATLAB MatLab Programming Language External Interface (Mex-files) Interface with C, Java and Fortran Programs Graphics 2-D Graphics 3-D Graphics Color and Lighting Animation Audio and Video Built-in Functions User-written Function Computations Linear Algebra Data Analysis Signal Processing Polynomials &Interpolation Quadrature Solution of ODEs Toolboxes (Collections of specialized Function) • * Signal processing • * Statistics • * Control System • * System Identification • * Neural Networks • * Communications • * Symbolic Mathematics * Image Processing * Splines * Robust Control * M-Analysis &synthesis * Optimization * Financial AND MANY MORE
Introduction to Matlab 1. MATLAB is an interpreted language (code is compiled each time it is run. 2. MATLAB is easy to use (Mathematical operations) and has a complete documentation online. 3. MATLAB is Excellent for manipulating large amounts of tabular data (arrays, matrices) in a consistent way. 4. MATLAB has excellent visualization tools (plotting data and functions) 5. MATLAB has Lots of built-in functions for applied mathematics such data analysis, interpolation, linear algebra, Fourier analysis,… 6. MATLAB has many toolboxes (statistical, financial, symbolic,…) 7. MATLAB is a good programming language. 8. MATLAB allows to do numerical simulation based on numerical analysis algorithms. 9. MATLAB allows interfacing with programs in other language (C, Fortran, …).
Introduction to Matlab 1.2 Short History ( http://en.wikipedia.org/wiki/MATLAB ) MATLAB was invented in the late 1970sby Cleve Moler, then chairman of the computer science department at the University of New Mexico. He designed it to give his students access to LINPACKand EISPACKwithout having to learn Fortran. It soon spread to other universities and found a strong audience within the applied mathematics community. Jack Little, an engineer, was exposed to it during a visit Moler made to Stanford University in 1983. Recognizing its commercial potential, he joined with Moler and Steve Bangert. They rewrote MATLAB in C and founded The Math Worksin 1984to continue its development. These rewritten libraries were known as JACKPAC. MATLAB was first adopted by control design engineers, Little's specialty, but quickly spread to many other domains. It is now also used in education, in particular the teaching of linear algebra and numerical analysis, and is popular amongst scientists involved with image processing.
Introduction to Matlab 1.3 What is MATLAB useful references • Full documentation available online in HTML and PDF format. http://www.mathworks.com/access/helpdesk/help/helpdesk.html • Many documents on the web (http://www.google.com.sa) • Notice: there are many freeware/sharewares similar to MATLAB. For instance SCILAB (http://www-rocq.inria.fr/scilab ) Read “Getting Started” section of the MATLAB manual
Introduction to Matlab 1.4 How to run MATLAB • To run MATLAB on a PC double-click on the MATLAB icon on the desktop. • To run MATLAB on a Unix system, Type MATLAB at the prompt. When MATLAB starts, a window appears (MATLAB Desktop) containing three smaller windows of different size: The Command Window, The Current Directory Window , and The Command History Window. In the command window you should see a message: To get started, select MATLAB Help or Demos from the Help Menu. >>
Introduction to Matlab Curry directory MATLAB Prompt Tells that MATLAB is ready for your Command >> >> >>playbackdemo(‘desktop’) >>playbackdemo(‘historywindow’) >>playbackdemo(‘currdirectory’) >>playbackdemo(‘helpwindow’) MATLAB DESKTOP helpdesk lookfor matrix Lookfor diagonaliation Lookfor diadonal Lookfor spectrum Lookfor series Las=3 home Command Windows Command History
Introduction to Matlab SIMULINK OPEN FILES HELP NEWFILE
Introduction to Matlab • In the command window: • To type commands the cursor must be placed after the command prompt (>>). • Once the command typed, you have to press the “enter” key for executing the command. • You can type many commands on the same line separated between them by a comma (,) . 1.5 How to quit MATLAB To end a MATLAB session type • quit or exit at the MATLAB prompt. • Click on the symbol on the upper right of the MATLAB window. X
Introduction to Matlab >> Command Window 39*4.4+5 ans = 176.6000 The MATLAB command THE RESULT
Introduction to Matlab 1.6 Help me MATLAB! To get started, type one of these commands: • help: Opens a MATLAB help at the prompt. • helpwin: Opens a MATLAB help GUI • helpdesk: Opens a MATLAB hypertext help browser • demo(s): Starts the MATLAB demonstration You can click on the icon on the MATLAB window ? • You can learn how to use any MATLAB command by typing help followed by the name of the command, for example >>help sin. • You can also use the lookfor command, which searches the help entries for all MATLAB commands for a particular word. • you could type >> lookfor inverse. MATLAB responds with the names of the commands that have the searched word in the first line of the help entry. You can search the entire help entry for all MATLAB commands by typing >> lookfor –all inverse.
Introduction to Matlab REMARK on the “HELP” command For example, help solve will display documentation for solve. Unless you have a large monitor, the output of help solve will not fit in your MATLAB command window, and the beginning of the documentation will scroll quickly past the top of the screen. You can force MATLAB to display information one screenfulat a time by typing more on. You press the space bar to display the next screenful, or ENTER to display the next line; type help more for details. Typing more on affects all subsequent commands, until you type more off.