Prev Up Next
Go backward to 2.1 Basic Use of MATLAB
Go up to 2 Starting with MATLAB
Go forward to 2.3 Using Data Files

2.2 Obtaining Help from MATLAB

General help can be found by using the Help Desk, which can be started by typing helpdesk at the MATLAB prompt. This opens a Web browser (Netscape or Internet Explorer, for example) that enables the user to search for help on topics.

In general, help for the functions in MATLAB can be found by typing lookfor and then a relevant word. MATLAB will then display any functions that may be relevant. For example, try typing lookfor cos at the MATLAB prompt. My computer produces the following (some has been omitted):

>> lookfor cos
ACOS    Inverse cosine.
ACOSH   Inverse hyperbolic cosine.
ACSC    Inverse cosecant.
.
.
.
LQGCOST Function which returns the difference between the

The MATLAB functions are displayed on the left, with a brief description of their purpose on the right. Sometimes the information to be displayed will be too much to fit on the screen. If this happens, type more on at the MATLAB prompt so that MATLAB will display only one screen at a time. Type more off to turn off this feature.


 If information scrolls off the screen, type more on at the MATLAB prompt. This will present information one screen at a time. Pressing the space bar presents a new screen of information; pressing RETURN or ENTER will present one more line.

The MATLAB function help can then be used to explain how to use the function. For example,

>> help cos
 
 COS    Cosine.
        COS(X) is the cosine of the elements of X. 
>> help acosh
 
 ACOSH  Inverse hyperbolic cosine.
        ACOSH(X) is the inverse hyperbolic cosine of...
 
Although it doesn't say, MATLAB always assumes the values are in radians when using trigonometric functions. MATLAB commands need to be entered in lower case. While the help places the commands in upper case to distinguish commands from the text, this can be confusing.


 Always use lower case for MATLAB commands.

Here is an example of using cos:

>> cos(2)                                        
ans =
   -0.4161
>> cos(pi)           %Notice that pi is used for 3.141592...  
ans =
    -1
 
>> x=[0, pi/6, pi/4, pi/3, pi/2];  
>> cos(x)
ans =
    1.0000    0.8660    0.7071    0.5000    0.0000

Peter Dunn

Prev Up Next