Programming for Chemical Engineers Using C, C++, and MATLAB

Chapter 6: Introduction to MATLAB

OVERVIEW

There are many approaches to teaching the basics of MATLAB. This book will introduce MATLAB through a C programmer's point of view. In this way, the transition from the first half of the book (learning C/ C++ programming) to the second half of the book (understanding MATLAB programming) will be much easier.

Like C/C++ and other programming languages, MATLAB, has arithmetic, logical, conditional, and looping operations but with much, much more.

This chapter will introduce MATLAB and explore the following concepts:

MATLAB Environment

  • MATLAB Desktop

  • Command Window

  • Command History Window

  • Editor/Debugger

  • Workspace

  • Current Directory Window

  • Array Editor

  • Help Window

Developing M-Files

Variable and Constant Name Declaration

Basic Output and Input Statements

  • Output Statements

  • Input Statements

Operators

  • Arithmetic and Assignment Operators

  • Relational Operators

  • Logical Operators

Conditional Statements

  • if-else Statement

  • if-elseif Statement

  • switch/case Statement

Looping Statements

  • for Loop Statement

  • while Loop Statement

Scalars, Vectors, and Matrices

  • Initialization

  • Manipulating Arrays

  • Arithmetic Operation

Creating Functions

Plotting

  • Basic 2D Plotting

  • Axis Command Functions

  • Titles and Labels

  • Adding Lines to Graphs

  • Setting of Line Style and Width

  • Basic 3D Plotting

All program listings discussed in this chapter can be found on the CD-ROM.

\Program Listings\Chapter 6\flue.mat   Flue Temp                                       Distribution\Program Listings\Chapter 6\PL6 l.m    Program Listing   6.1\Program Listings\Chapter 6\PL6 2.m  ...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Robot Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.