Engineering Fundamentals: An Introduction to Engineering, 4th ed.c

(Steven Felgate) #1
As shown in Figure 15.1, the MATLAB’s desktop layout, in default mode, is divided into four win-
dows: the Current Folder, the Command Window, workspace, and the Command History. You
type (enter) commands in the Command Window. For example, you can assign values to variables
or plot a set of variables. The Command History window shows the time and the date of the
commands you issued during previous MATLAB sessions. It also shows the history of commands
in the current (active) session. You can also transfer old commands, which you issued during pre-
vious sessions, from the Command History Window to the Command Window. To do this,
move your mouse pointer over the command you want to move then click the left button, and,
while holding down the button, drag the old command line into the Command Window. Alter-
natively, when you strike the up-arrow key, the previously executed command will appear again.
You can also copy and paste commands from the current Command Window, edit them, and use
them again. To clear the contents of the Command Window, type clc.
Once in the MATLAB environment, you can assign values to a variable or define the ele-
ments of a matrix. For example, as shown in Figure 15.2, to assign a value of 5 to the variable
x, in the Command Window after the prompt sign >>you simply type x=5. The basic
MATLAB scalar (arithmetic) operations are shown in Table 15.1.
As we explained in Section 14.7, during your engineering education, you will learn about
different types of physical variables. There are those that are identifiable by a single value or by
magnitude. For example, time can be described by a single value such as two hours. These types
of physical variables which are identifiable by a single value are calledscalars. Temperature is an-
other example of a scalar variable. On the other hand, if you were to describe the velocity of a

15.1 MATLAB —Basic Ideas 463


1


2


3


6


6


5 4


■Figure 15.1 The desktop layout for MATLAB.


Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).

圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀

Free download pdf