basic MATLAB operations Flashcards
1
Q
How would you wirte a first step last operation?
A
variable=[first:step:last]
2
Q
Form a row vector
A
a=[2 3 5]
3
Q
Form a column vector
A
b=[3;1;8]
4
Q
Form a 2x2 matrix
A
c=[1 2;7 8]
5
Q
Size of a vector a
A
size(a)
6
Q
Size of row of vector a
A
size(a,1)
7
Q
Size of column of vector a
A
siza(a,2)
8
Q
absolute function
A
abs
9
Q
natural logorithim
A
log
10
Q
What does A(4,:) show
A
all elemnts in 4th row of matrix A
11
Q
What does A([1 3],[2 4]) show
A
elements in rows 1&3, columns 2&4
12
Q
How to plot a graph (2 steps)
A
1) define graph f(x)=
2) fplot(f, [-1:1]):
13
Q
How would you write a linspace operation?
A
a=linspace(first,last,N)
14
Q
create an array of all zeros
A
z=zeros(m,n)
15
Q
create an array of all ones
A
o=ones(m,n)