Affordable Access

Laboratory on Matlab

Publication Date
  • Computer Science


An Introduction to MATLAB ELEC6021 An Introduction to MATLAB: Session 1 Lecturer: Rob Maunder [email protected] Short for “Matrix Laboratory”, MATLAB is a proprietary numerical computing environment. To perform numerical calculations MATLAB uses a scripting or interpreted programming language, meaning that the source code is not compiled such as in the C programming language but rather is interpreted each time the program is executed. MATLAB is commonly used in industry and academia for its ease of programming and vast libraries of functions. This session will guide you through the basics of the programming language and does not cover everything. On Windows systems, MATLAB can be started through the Start button. Once opened, the MATLAB environment should look similar to Figure 1. Figure 1 The MATLAB environment. 1. Finding your way around TASK 1 Identify components of the environment:  Command History Window  Command Window  Start Button and Launch Pad  Help Browser  Current Directory Browser  Workspace Browser 1 TASK 2 Documentation on MATLAB is readily available via the Help Browser, the Internet, or the help command. At the Command Window type: help help Press Enter to execute the command. This command will display text in the Command Window explaining what help does and how to use it. The most common use of the help is to find out what a certain command or function does in MATLAB. 2. The Basics TASK 3 Try some simple operations. For scalar addition, subtraction, multiplication, and division type in the Command Window: 6+2 9-5 46*0.5 8/5 Notice how MATLAB always saves the result in a variable called ans. Good programming practice in MATLAB is to never use ans as a variable name. If a value is assigned to a variable ans is not used. Try: a = 2 b = 5; QUESTION What does the semicolon do? MATLAB also has native support for complex numbers, both i and j ha

There are no comments yet on this publication. Be the first to share your thoughts.