Matlab

Ace your homework & exams now with Quizwiz!

What two-symbol sequence outputs the percent symbol in fprintf?

%%

When using "fprintf" to print numerical output, explain the basic formatting differences of operators %e, %f, and %g

%f fixed-point, %e scientific notation, %g is %e or %f depending upon which is shorter

Good practice is to include the _____ _______ when creating a 2D array, to make the rows clearly visible to someone reading the program.

Inner Brackets

What function obtains a number from a user?

Input

What does %i stand for?

Integer

What is a main drawback to Matlab?

Interpreters requires additional steps to execute a program

What command creates a row array of linear spaced points, given a start value, stop value, and the number of desired points?

Linspace

Logarithm to base e is represented as

Log

_______ _______ extract elements from an array with a logical array.

Logical Indexing

A programmer running the MATLAB application can enter a valid statement, and the MATLAB application will carry out the necessary computations for that statement using what is called the______ _______.

MATLAB Interpreter

MATLAB® provides a wide variety of options for the display of 2D data. What is the function of semilogx ?

Makes a 2D line plot with logarithmic x and linear y axis

MATLAB® functions are pre-defined functions that a programmer can call to perform advanced ________ _______ , such as computing a square root, absolute value, sine, cosine, etc.

Mathematical Calculations

A two-dimensional array or 2D array has elements arranged into rows and columns. In mathematics, a 2D array is commonly called a ______.

Matrix

Engineers have continued to find ways to make smaller transistors, leading to what is known as ______ _____ : the doubling of IC (integrated circuit)capacity roughly every 18 months, which continues today.

Moore's Law

A good practice is to give a variable a meaningful _____ that describes the variable's purpose.

Name

An unsigned binary number can only represent what kind of values?

Non-negative Values

What does NaN stand for?

Not a number

What occurs when the result of an expression exceeds the maximum value that can be stored within a variable?

Overflow

The first step in incremental programming is to create a well defined ______ ________.

Problem statement

A common use of logical operators is to detect if a value is within a _______.

Range

A _______ _________ compares two numerical values and evaluates to a logical value or either true or false.

Relational Operator

MATLAB generates an error message when a program reads an element outside the range of an existing array. In contrast, if a program assigns a value to an array element outside the range of an existing array using row-column indexing, then the interpreter _____ _____ ______ to accommodate the new element.

Resizes the matrix

What does the function gcd do?

Returns the greatest common devisor

_______ _______ uses a single index to refer to an array element.

Row-column indexing

A common error is to modify but not _____ a function before running.

Save

A _____ variable contains a single element.

Scalar

What do you call a sequence of statements stored in a file?

Script

In the context of creating a column array, the _______ separates rows, just as commas separate different array elements in a single row.

Semicolon ;

A logical operator evaluates operands from left to right. _____ ______ ________ skips evaluating later operands if the result of the logical operator can already be determined.

Short Circuit Operation

It is good practice to use a _____ _______ ______ when accessing an entire row or column. Such use eases the programming task, while also clarifying the program's intent.

Single colon index

Logical operators are applied to arrays on an element-wise basis. The two array arguments should therefore be the same ____ otherwise the interpreter returns an error.

Size

The command stringScalarIn = string(input(prompt,"s")) returns the entered text as a ______ ______, without evaluating the input as an expression.

String Scalar

Assume dataVec = [ 0.0, 0.6, 0.63, 0.9, 0.91, 1.03 ]. Write arrays as [ 1, 2, 3 ].

Sum (dataVec)

One of the most useful features of MATLAB is that a programmer can easily use the command line to test and verify what a command produces. Good practice is to _____ _____ ______ of the code on the command line to confirm the code operates as expected.

Test small parts

fieldWidth _______.

The maximum field width that will be displayed

How are the naming (identifier) rules different for arrays and variables?

They are not

Given vals = [45, 55, 65, 75, 85, 95] True or False: vals(end:-1:1) yields [95, 85, 75, 65, 55, 45].

True

True or False: A processor is a circuit that executes instructions.

True

True or False: Although writing to an element outside the current element range automatically increases an array's size, reading an element outside the range is not allowed and yields an error.

True

True or False: The comparison kmetersRun == kmetersBiked should be avoided.

True

True or False: The following command generates an error because the array lengths differ: plot( [2, 4, 6], [99, 88] )

True

A logical value, also known as a Boolean value, can be only ____ or _____?

True (1), False (0)

Machine language is founded on an alphabet of how many characters?

Two

A program uses a ______ to remember values as the program executes instructions.

Variable

The disp function outputs unformatted variables to the command window without outputting the ________ _____.

Variable's Name

MATLAB has ________ (i.e., a sequence of interactive steps that eases the use of a specific software feature) to interactively import data from a variety of file types.

Wizards

MATLAB installations provide the ability to auto-generate code to produce a specific graph. This allows a programmer in MATLAB to focus on generating the data and not on _______ ____ to produce detailed graphs.

Writing code

Assume sampleMatrix = [ 1,2,3,4; 5,6,7,8 ]. Write arrays as [ 1, 2; 3, 4 ]. For y = length(sampleMatrix), what is the value of y?

Y = 4

What array does [2, 4, 9] .* [-1, -1, -1] create?

[-2,-4,-9]

What does vals equal after executing vals = xor([1, 1, 0], [0, 1, 0])?

[1, 0, 0]

What new array does vals = logspace(2, 4, 3) create? Type array as: [1, 2, 3] (integers only).

[100, 1000, 10000]

Given nums = [19, 23]. What is nums after the statement nums(2) = 34?

[19,34]

Regarding marker plot specifiers, a "p" represents:

a five-pointed star (pentagram)

Which is a valid identifier: a. $tarwars b. r2d2 c. dar-th3

b

A computer typically consists of several components:

input/output, storage (disk), memory (RAM), clock and processor

Matlab can solve systems of ________ ________, simulate differential ______________, and perform iterative _______________ Calculations.

linear equations, equations, numerical

In MATLAB the largest magnitude of a number is given by the constant ______, and the smallest by _______.

realmax, realmin

When working with character variables a common error is to use _____quotes rather than ______ quotes around a character literal.

single, double

How could you check if a variable name "squareroot" is already used in the base workspace? (and therefore safe to use as a variable identifier?)

using the statement "exist varName" where varName is the name to be checked.

A matrix with two or more dimensions is also called an _____.

Array

By default, the plotted figure automatically determines the x and y-axis limits based on the data. The programmer can set the x and y-axis limits using the ____ command.

Axis

The ________ _______ is encountered frequently in an experiment that has two possible outcomes.

Binomial Distribution

What does the function std calculate?

Calculates the standard deviation

When concatenating, it is good practice to use a _____ when concatenating row arrays, to reduce misunderstandings.

Comma

The _______ _______ provides the basic method in which a programmer types statements to be executed by the MATLAB interpreter, and presents the user with an interactive environment.

Command Window

Row array elements can be separated by _____ or _____.

Commas, spaces

What is one reason computers are indispensable for modern engineering?

Complex Calculations can be perfor.ed quicker with fewer mistakes.

An element-wise operator performs an operation on each ________ _____ of elements of two one-dimensional (1D) arrays, yielding a new array.

Corresponding Pair

An array is constructed using _____, while an array element is accessed using _____.

Curly Brackets, Parenthesis

A _______ ________ is a list of statements that a programmer creates and gives a specific name.

Custom Function

True or False: In MATLAB, the % character is the only character that indicates a comment.

False, "%{" "%}" indicates a block comment

True or False: A one dimensional array is sometimes called a function.

False, Vector

True or False: In MATLAB, an "=" implies connection or equivalency.

False, assignment

True or False: The variables created by the script are eliminated from the base workspace after the script runs.

False, it updates the variables

True or False: Expressions must be written on one line.

False, use a continuation: "..."

Unwinding a 2D array into a column array according to the linear indexing sequence is known as _______ an array into a column.

Flattening

Good practice is not to use _______ ______ arrays as indexing arrays; such use may yield unpredictable results.

Floating Point

What is the size of A? Express answer as AxB. • A = [ 2, 5, 3, 5, 7; 4, 2, 1, 6, 8; 6, 3, 2, 1, 1];

3X5

If myArray = [40, 43, 46, 49, 52], then myArray( [3, 4, 5] ) yields _____.

46, 49, 52

How many rows does milesTraveled contain? milesTraveled = [30; 45; 27; 118; 96]

5

How many elements are in the row array constructed by [31:1:90] ?

60

Matlab excels at?

Graphing Mathematical Computations, especially computations involving matrices

Pressing the up-arrow key is a useful feature that can retrieve what?

A command (or sequence of commands) from a previously-entered line

What is the difference between a signed integer and an unsigned integer?

A signed integer represents both positive and negative integer values. An unsigned integer represents only non-negative integers.

Any sequence of characters, including special characters is called _____.

A string

The _______ of a floating-point number is defined as how close the stored number is to the desired value.

Accuracy

A number in base ten is called a ______ number while a number in base two is called a ______ number.

Decimal, Binary

A common error is to attempt to use row-column indexing in an assignment to the empty array operator, to ______ __ _____ _______ from a 2D array. This will cause an error.

Delete a single element

The dimension of an array is the number of indices needed to select an _______.

Element

Sometimes a programmer wishes to access the last element of a one-dimensional array. While a 1 always refers to the first element of a one-dimensional array, the keyword _____ as an index always refers to the last element of a one-dimensional array.

End

Good practice is to avoid comparing floating-point numbers for exact _______ , instead comparing for the numbers being close enough.

Equality

Given rowEx = [3:1:10], what does the statement rowEx(9) return?

Error

What is the name for the combination of items like variables, constants, and operators, that results in a value?

Expression

Assume nums = [-9.5, 300, 107.6, 0.3] True or False: nums == (0.1 + 0.2) creates the logical array [0, 0, 0, 1]

False

True or False: A function whose output is [x, y] indicates output of an array with two scalar values.

False

True or False: Comments used to explain how programs run are seen as unprofessional because the programming code should be clear enough in itself.

False

True or False: Differing numbers of rows generates a vertcat error.

False

True or False: Pseudo-code is MATLAB code that runs but isn't yet complete.

False

True or False: The statement myVar = 23 results in a 1x1 array.

False


Related study sets

Intro to Old Testament FSU- Final

View Set

Chapter 11, Conflict in Small group

View Set

Health 6.01: Injuries and Taking Risks, Part 1

View Set

Biology 223 Chapter 6 Practice Questions

View Set

Praxis Interactive Test ESOL 5362

View Set