0% found this document useful (0 votes)
26 views31 pages

Cengage Reviewer PDF

The document provides an overview of MATLAB, highlighting its features such as strong typing, array operations, and debugging tools. It discusses various commands and functionalities, including how to manage the workspace, handle errors, and create plots. Additionally, it emphasizes the importance of defining variables and using specific functions for array creation and text formatting.

Uploaded by

AC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views31 pages

Cengage Reviewer PDF

The document provides an overview of MATLAB, highlighting its features such as strong typing, array operations, and debugging tools. It discusses various commands and functionalities, including how to manage the workspace, handle errors, and create plots. Additionally, it emphasizes the importance of defining variables and using specific functions for array creation and text formatting.

Uploaded by

AC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

#1 MATLAB HAS MANY ADVANTAGES

#2 BESIDES SEPARATING THE ROWS

#3 ARRAYS IN MATLAB CAN HAVE MORE

#4 MATLAB IS A STRONGLY TYPED


#5 WHICH OF THE FOLLOWING IS THE FUNDAMENTAL UNIT

#6 THE CONTENTS OF THE CURRENT WORKSPACE

#7
#8 IF AN EXPRESSION WITHOUT AN EQUAL SIGN

Answer: True

#9 WHEN A USER ENTERS A NAME AT THE

Answer: True

#10 THE SECOND TYPE OF ERROR

#11 ERRORS IN PROGRAMS ARE

#12 IN THE EVENT THAT A SCRIPT


#13 MATLAB INCLUDES A SPECIAL

#14 WHICH OF THE FOLLOWING COMMANDS WILL

#15

Answer: Workspace browser – displays names and values of variables.


Current Folder Browser – displays names of files in the current directory
#16 THE FIRST TYPE OF ERROR

#17 IF THE USER CREATES A SCRIPT OR

Answer: TRUE

#18 IN SHORT FOR

Answer: Matrix Laboratory


The contents of the current workspace can also be examined with a GUI-based Workspace Browser.
right
The Workspace Browser appears by default on the -hand side of the desktop.

control + c
In the event that a script is running an infinite loop, the user can use the command
to halt the process and regain control.

Find
MATLAB includes the command to help you find out just which version of a file is
being executed, and where it is located. This can be useful in finding filename conflicts.

The contents of the current figure window can be cleared at any time using
Clear Figure
the command.

MATLAB does not provide a predefined value for pi. Therefore, users must define pi themselves
using mathematical functions that are built-in, e.g., pi = 4 * atan(1).

a. True

b. False
It is possible to prompt a user and initialize a variable with data typed directly using
input
the function. This function displays a prompt string in the command window and
then waits for the user to type in a response.

Array
operations are operations performed between arrays on an element-by-element
Matrix
basis. operations follow the normal rules of linear algebra, such as matrix
multiplication.
Arrays in MATLAB can have more than two dimensions, i.e., more than rows and columns.

a. True

b. False
run-time
The second type of error is the error. Such an error occurs when an illegal
mathematical operation is attempted during program execution (for example, attempting to divide
by 0). These errors cause the program to return Inf or NaN, which is then used in further
calculations.

symbolic
MATLAB includes a special debugging tool called a debugger, which is embedded
into the Edit/Debug Window. This tool allows you to walk through the execution of your program
one statement at a time, and to examine the values of any variables at each step along the way.
MATLAB always allocates array elements in order. That is, MATLAB
allocates the first column in memory, then the second, then the third, etc., until all of the columns
have been allocated.

MATLAB is a strongly typed language. This means that, before assigning a value to a variable in
MATLAB, you must first declare its type (double, char, etc.).

a. True

b. False
In mathematics, a function is an expression that accepts one or more input values and calculates a
single result from them. Like mathematical functions, MATLAB functions can return no more than
one result to the calling program.

a. True

b. False
Which of the following commands will print (in the command window) a list of the variables and
arrays in the current workspace?

a. clear

b. whos

c. control + c

d. clc

If an expression without an equal sign is typed into the Command Window, MATLAB will evaluate it
and store the result in a special variable called ans. Every time a new expression without an equal
sign is evaluated, the value saved in ans will be overwritten.

a. True

b. False
If the user creates a script or function with the same name as a MATLAB function or command,
MATLAB will always prefer and execute the built-in function or command rather than the user-
defined script or function.

a. True

b. False
When a user enters a name at the MATLAB prompt, the MATLAB interpreter first attempts to find
the name among the variables in the workspace. Therefore, if you define a variable with the same
name as a MATLAB function or command, that function or command becomes inaccessible.

a. True

b. False
#19
#20
Answers:

Array – fundamental

Vector – one dimension

Scalar – one row one column

Matrix – 2 or more dimensions

INSTEAD OF TYPING COMMANDS DIRECTLY

MATLAB DOES NOT PROVIDE


IS A REGION OF MEMORY

IF AN EXPRESSION WITHOUT AN EQUAL

IN MATHEMATICS, A FUNCTION

THE THIRD TYPE OF ERROR


IF THE USER CREATES A SCRIPT OR FUNCTION

MATLAB ALWAYS ALLOCATES ARRAY ELEMEN

THERE IS AN AUTO-COMPLETE FEATURE

OPERATOR SPECIFIES A WHOLE SERIES OF VALUES


BESIDES SEPARATING THE ROWS IN AN ARRAY

THERE ARE THREE WAYS


The contents of the current workspace can also be examined with a GUI-based Workspace Browser.
right
The Workspace Browser appears by default on the -hand side of the desktop.

control + c
In the event that a script is running an infinite loop, the user can use the command
to halt the process and regain control.

w hich
MATLAB includes the command to help you find out just which version of a file is
being executed, and where it is located. This can be useful in finding filename conflicts.
The contents of the current figure window can be cleared at any time using
clf
the command.

MATLAB does not provide a predefined value for pi. Therefore, users must define pi themselves
using mathematical functions that are built-in, e.g., pi = 4 * atan(1).
a. True

b. False
It is possible to prompt a user and initialize a variable with data typed directly using
input
the function. This function displays a prompt string in the command window and
then waits for the user to type in a response.

Array
operations are operations performed between arrays on an element-by-element
Matrix
basis. operations follow the normal rules of linear algebra, such as matrix
multiplication.
Arrays in MATLAB can have more than two dimensions, i.e., more than rows and columns.

a. True

b. False
run-time
The second type of error is the error. Such an error occurs when an illegal
mathematical operation is attempted during program execution (for example, attempting to divide
by 0). These errors cause the program to return Inf or NaN, which is then used in further
calculations.

symbolic
MATLAB includes a special debugging tool called a debugger, which is embedded
into the Edit/Debug Window. This tool allows you to walk through the execution of your program
one statement at a time, and to examine the values of any variables at each step along the way.

column major
MATLAB always allocates array elements in order. That is, MATLAB
allocates the first column in memory, then the second, then the third, etc., until all of the columns
have been allocated.

MATLAB is a strongly typed language. This means that, before assigning a value to a variable in
MATLAB, you must first declare its type (double, char, etc.).

a. True

b. False
In mathematics, a function is an expression that accepts one or more input values and calculates a
single result from them. Like mathematical functions, MATLAB functions can return no more than
one result to the calling program.

a. True

b. False
Which of the following commands will print (in the command window) a list of the variables and
arrays in the current workspace?

a. clear
b. whos

c. control + c

d. clc

If an expression without an equal sign is typed into the Command Window, MATLAB will evaluate it
and store the result in a special variable called ans. Every time a new expression without an equal
sign is evaluated, the value saved in ans will be overwritten.

a. True

b. False
If the user creates a script or function with the same name as a MATLAB function or command,
MATLAB will always prefer and execute the built-in function or command rather than the user-
defined script or function.

a. True

b. False
When a user enters a name at the MATLAB prompt, the MATLAB interpreter first attempts to find
the name among the variables in the workspace. Therefore, if you define a variable with the same
name as a MATLAB function or command, that function or command becomes inaccessible.

a. True

b. False
Once a plot has been created by a MATLAB program, it can no longer be modified. Therefore all
desired features should be prescribed in coding.

a. True
b. False
hold
The command prevents MATLAB from overwriting the data plotted on a figure when
a plot function is executed two or more times for that figure.

Special Greek and mathematical symbols may also be used in text strings. They are created by
embedding escape sequences into the text string. Escape sequences such as /lambda and /infty
would produce the lowercase Greek letter lambda and the infinity symbol, respectively.

a. True

b. False
MATLAB includes two functions, linspace and logspace, which address the disadvantages in the
colon operator method of creating arrays. They create an array with either linear or logarithmic
spacing between samples. When using them, you know how many points will be in the array and
that the specified last point will be in the array.

a. True
b. False
It is possible to enhance plotted text strings (titles, axis labels, etc.) with formatting such as bold
face, italics, etc., and with special characters such as Greek and mathematical symbols. The font
stream modifiers
used to display the text can be modified by .
hold off
A command switches plotting behavior back to the default situation,
in which a new plot replaces the previous one.
If a subplot command creates a new set of axes that conflict with a previously existing set, then what
happens to the older axes?

a. Deleted

b. Superimposed with axes

c. Bumped to previous position in subplot

d. Bumped to next position in subplot

Normally, a new plot is created each time that a plot command is issued, and the previous data
displayed on the figure are lost.

a. True
b. False
Once a plot has been created by a MATLAB program, it can no longer be modified. Therefore all
desired features should be prescribed in coding.

a. True
b. False
hold
The command prevents MATLAB from overwriting the data plotted on a figure when
a plot function is executed two or more times for that figure.

Special Greek and mathematical symbols may also be used in text strings. They are created by
embedding escape sequences into the text string. Escape sequences such as /lambda and /infty
would produce the lowercase Greek letter lambda and the infinity symbol, respectively.

a. True

b. False
MATLAB includes two functions, linspace and logspace, which address the disadvantages in the
colon operator method of creating arrays. They create an array with either linear or logarithmic
spacing between samples. When using them, you know how many points will be in the array and
that the specified last point will be in the array.

a. True
b. False
It is possible to enhance plotted text strings (titles, axis labels, etc.) with formatting such as bold
face, italics, etc., and with special characters such as Greek and mathematical symbols. The font
stream modifiers
used to display the text can be modified by .
hold off
A command switches plotting behavior back to the default situation,
in which a new plot replaces the previous one.
If a subplot command creates a new set of axes that conflict with a previously existing set, then what
happens to the older axes?

a. Deleted

b. Superimposed with axes

c. Bumped to previous position in subplot

d. Bumped to next position in subplot

Normally, a new plot is created each time that a plot command is issued, and the previous data
displayed on the figure are lost.

a. True
b. False
hold
The command prevents MATLAB from overwriting the data plotted on a figure
when a plot function is executed two or more times for that figure.

( TAMA TO LAHAT NAKALIMUTAN KO LANG ICONNECT UNG ISA )

If a subplot command creates a new set of axes that conflict with a previously existing set, then
what happens to the older axes?

a. Bumped to previous position in subplot


b. Bumped to next position in subplot

c. Superimposed with axes

d. Deleted

(TAMA LAHAT)

plots
One of the most powerful features of MATLAB is the ability to easily create that
visualize the information which the engineer works with. In other programming languages used
by engineers (such as C++, Java, Fortran, and so forth), this would be a major task.
TAMA LAHAT

In general, if the range of the data being plotted covers many orders of magnitude,
logarithmic
a(n) scale will be more appropriate. If the data being plotted covers a relatively
logarithmic
small dynamic range, then scales work very well. ( MALI YAN RED)

MATLAB includes two functions, linspace and logspace, which address the disadvantages in the
colon operator method of creating arrays. They create an array with either linear or logarithmic
spacing between samples. When using them, you know how many points will be in the array and
that the specified last point will be in the array.

a. True

b. False

The bar and barh functions can also take two-dimensional array arguments. If an array
argument is supplied to these plots, the program will display each column as a separately
colored bar on the plot.

a. True

b. False
It is possible to enhance plotted text strings (titles, axis labels, etc.) with formatting such as bold
face, italics, etc., and with special characters such as Greek and mathematical symbols. The font
stream modifier explanation
used to display the text can be modified by . ( MALII)

** PASABI NALNG TAMANG SAGOT SA MGA NAKARED PU TY.


hold
The command prevents MATLAB from overwriting the data plotted on a figure
when a plot function is executed two or more times for that figure.

( TAMA TO LAHAT NAKALIMUTAN KO LANG ICONNECT UNG ISA )

If a subplot command creates a new set of axes that conflict with a previously existing set, then
what happens to the older axes?

a. Bumped to previous position in subplot


b. Bumped to next position in subplot

c. Superimposed with axes

d. Deleted

(TAMA LAHAT)

plots
One of the most powerful features of MATLAB is the ability to easily create that
visualize the information which the engineer works with. In other programming languages used
by engineers (such as C++, Java, Fortran, and so forth), this would be a major task.
TAMA LAHAT

In general, if the range of the data being plotted covers many orders of magnitude,
logarithmic
a(n) scale will be more appropriate. If the data being plotted covers a relatively
linear
small dynamic range, then scales work very well.

MATLAB includes two functions, linspace and logspace, which address the disadvantages in the
colon operator method of creating arrays. They create an array with either linear or logarithmic
spacing between samples. When using them, you know how many points will be in the array and
that the specified last point will be in the array.

a. True

b. False

The bar and barh functions can also take two-dimensional array arguments. If an array
argument is supplied to these plots, the program will display each column as a separately
colored bar on the plot.

a. True

b. False
It is possible to enhance plotted text strings (titles, axis labels, etc.) with formatting such as bold
face, italics, etc., and with special characters such as Greek and mathematical symbols. The font
stream modifiers
used to display the text can be modified by .

You might also like