Coding 1 Final MATLAB Flashcards
What should variables start with?
A letter of the alphabet, and then they can have letters, digits, and underscores.
What does clear do?
Removes all variables in the workspace
Are variable names case-sensitive
Yes
What does clc do?
clears command window display
what does who do
displays a list of all variables stored
what does whos do?
Provides a more detailed list of the variables, including the size and data type of each variable.
what does abs() do?
finds the absolute value of a number in the parenthesis.
what does nthroot(X,N) do?
Finds the nth root of x
What does MATLAB stand for?
Matrix Laboratory
What is a colon operator?
first:step:last
what does 5:3:14 return?
[5 8 11 14]
what does 1:4 return?
[1 2 3 4]
what does 4:-1:1 return?
[4 3 2 1]
what does Linspace(x,y,n) do?
Creates a linearly spaced vector with n values in the inclusive range from x to y
What does Linspace(4,7,3) return?
[4 5.5 7]
what is the default number of points for linspace if n is omited
100 points
What does Logspace(x,y,n) do?
Creates a logarithmically spaced vector with n values in the inclusive range from 10^x to 10^y
what does logspace(2,4,3) return?
[100 1000 10000]
what is the default number of points if n is omitted in logspace?
50 points
What is concatenation?
Creating vectors by joining together existing vectors or adding elements to existing vectors
what is an algorithm
A sequence of steps needed to solve a problem.
What is a modular program
Multiple functions that implement each step.
Where do inputs come from
external device, the user
Where does the output go?
To an external file, and to the screen
Where are scripts stored
in m-files
what does “type” do?
Display a script in the command window
%
Creates a comment from % till the end of the line
disp
A quick way to display things
fprintf
A way to display things with formatting
\n
newline character
what is used to represent false
0
what is used to represent true
any non-zero value
what does an if-else statement do?
It chooses between two actions, only one action is executed