linspace - ANSWER Creates a linearly spaced vector:
example: (numbers from 2 to 4 in 3 digits equally spaced)
>>linspace(2,4,3)
234
logspace - ANSWER creates a logarithmically spaced vector
example:(numbers from 10^1 to 10^2 in 2 digits)
>>logspace(1,2,2)
10 100
rand(n) - ANSWER creates an nxn matrix of random reals
rand(n,m) - ANSWER creates an nxm matrix of random reals
randi([range],n,m) - ANSWER creates an nxm matrix of random integers in the range
zeros(n) - ANSWER returns an nxn matrix of all zeros
zeros(n,m) - ANSWER returns an nxm matrix of all zeros
ones(n) - ANSWER returns an nxn matrix of all ones
, ones(n,m) - ANSWER returns an nxm matrix of all ones
length - ANSWER returns the number of elements in a vector or the larger dimension for
matrix
size - ANSWER returns the number of rows and columns:
to capture the values in separate variables
[r, c] = size(mat)
r= 3
c=2
numel - ANSWER returns total number of elements in a vector or matrix
reshape (mymat,n,m) - ANSWER changes dimensions
example:
25
78
53
>> reshape(mymat,1,6)
ans =
275583
rot90 - ANSWER rotates a matrix 90 degrees counterclockwise
fliplr - ANSWER flips columns of matrix left to right
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Easton. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.