4.1 Program Design and Development
4.2 Relational Operators and Logical Variables
4.3 Logical Operators and Functions
4.4 Conditional Statements
4.6 The switch Structure
4.7 Debugging MATLAB Programs
4.8 Applications to Simulation
The MATLAB interactive mode is very useful for simple problems. but more complex problems require a script file. Such a file can be called a computer program. and writing such a file is called programming. Section 4.1 presents a general and efficient approach to the design and development of programs. The usefulness of MATLAB is greatly increased by the use of decision-making functions in its programs. These functions enable you to write programs whose operations depend on the results of calculations made by the program. Sections 4.2. 4.3. and 4.4.deal with these decision-making functions. MATLAB can also repeat calculations a specified number of times or until .some condition is satisfied. This feature enables engineers to solve problems of great complexity or requiring numerous calculations. These “loop” structures are covered in Section·4.5.
The switch structure enhances the MATLAB decision-making capabilities. This topic is covered in Section 4.6. Use of the MATLAB editorl Debugger for . debugging programs is covered in Section 4.7. Section 4.8 discusses “simulation,” a major application of MATLAB programs that enables us to study the operation of complicated systems, processes, and organizations. Tables summarizing the MATLAB commands introduced in this chapter appear throughout the chapter, and Table 4.9-1 will help you locate the information you need.