B: MATLAB Introduction The name MATLAB stands for matrix laboratory. Features: • • • • • • • Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user interface building. In short, MATLAB integrates data structure, programming and graphical user interface together. On Windows platforms, start MATLAB by double-clicking the MATLAB shortcut icon on your Windows desktop. MATLAB Desktop • Use desktop tools to manage your work in MATLAB. You can also use MATLAB functions to perform the equivalent of most of the features found in the desktop tools. Matlab major features and applications • Desktop Tools and Development Environment • The MATLAB Mathematical Function Library • The MATLAB Language • Graphics • MATLAB External Interfaces Command Window • Use the Command Window to enter variables and to run functions and M-file scripts. Ex 1. Ex 2. Command History • Statements you enter in the Command Window are logged in the Command History. From the Command History, you can view and search for previously run statements, as well as copy and execute selected statements. You can also create an M-file from selected statements. Help Browser • To open the Help browser, click the Help button in the desktop toolbar. • The Help browser consists of two panes, the Help Navigator, which you use to find information, and the display pane, where you view the information. Current Directory Workspace Browser • The MATLAB workspace consists of the set of variables (named arrays) built up during a MATLAB session and stored in this temporary memory. The features (e.g. dimension and data type) of these variables can be viewed in the workspace and these stored variables can be used in the subsequent calculation. • To delete variables from the workspace, select the variables and select Edit > Delete. Alternatively, use the clear function. • The core of MATLAB is array and matrix to conduct calculation and to store data. Creating Matrices Array Editor • Double-click a variable in the Workspace browser, or use openvar variablename, to see it in the Array Editor. Use the Array Editor to view and edit a visual representation of variables in the workspace. Adding and Subtracting Matrices Working with Workspace Use mathematical functions in Matlab Polynomials • Polynomials p(x) = x3 – 6x2 – 11x – 6 is represented as • The roots function calculates the roots of a polynomial: • The function poly returns the polynomial coefficients: Interpolation Interpolation • Linear interpolation (default) • Nearest neighbor interpolation • Cubic spline interpolation Running M-files in the Editor/Debugger