X = [1 5 2 4] |
Y = [3 2 2 6] |
---|---|
3 * X |
[3 15 6 12] |
X .* X |
[1 25 4 16] |
Y .^ 2 |
[9 4 4 36] |
X + Y |
[4 7 4 10] |
cos(X) |
[0.5403 0.2837 -0.4161 -0.6536] |
exp(Y) |
[20.0855 7.3891 7.3891 403.4288] |
log(X) |
[0 1.6094 0.6931 1.3863] |
zeros() | You will be adding or subtracting datasets |
ones() | You will be multiplying or dividing datasets |
rand() | You need a sample dataset |
nan() | You are overwriting cells with values that may be zero |
M(1:3) | displays first 3 elements in M |
M(3:5) | displays last 3 elements in M |
N = M(1:3) | create new array N that is a subset of M |
P = [M(1) M(3) M(4)] | create new array N that is a subset of M |
M(1:3) + P | [14 5 11] |
M(1) + M(4) | 16 |
M(7) | Does not exist - Index exceeds matrix dimensions. |
M(7) = 7 | [7 3 2 9 1 0 7] |
V = 1:1000 | V(20:4:850) |
A = ['J' 'a' 'n' 'e' ' ' 'S' 'a' 'y' 's'] |
A = 'Jane Says' |
B = ['I' '''m' ' ' 'd' 'o' 'n' 'e' ' ' 'w' 'i' 't' 'h' ' ' 'S' 'e' 'r' 'g' 'i' 'o'] |
B = 'I''m done with Sergio' (note 2 single quotes) |
A(1:4) = 'Dave' |
start = input('Enter the first value of your vector:');
stop = input('Enter the last value of your vector:');
dx = input('Enter the jump value:');
vector = start:dx:stop
lengthOnes = input('Enter the length of the ones vector:');
onesVector = ones(1,lengthOnes)
lengthZeros = input('Enter the length of the zeros vector:');
zerosVector = zeros(1,lengthZeros)
lengthRand = input('Enter the length of the rand vector:');
randVector = rand(1,lengthRand)
lengthNan = input('Enter the length of the NaN vector:');
nanVector = nan(1,lengthNan)
display('Now you can change the length of your rand vector.');
addRand = input('How many more values would you like to add?');
newLength = lengthRand + addRand;
randVector(newLength) = rand
display('Until we learn to use loops and if statements, we will have the extra zeros in our vector.');
fprintf('Now we will create a new rand vector with length %d',newLength);
newRandVector = rand(1,newLength)
"They misunderestimated me." |
"We're going to have the best-educated American people in the world." |
Don't wish it were easier, wish you were better
‘Responsibility is the price of greatness.’ — Winston Churchill
Freedom doesn't mean no responsibility. In fact, it requires extra responsibility. Freedom is the ability to make a choice, and responsibility is required once you make that choice.
Fairness isn't a handout. Fairness is the willingness to offer dignity to others. The dignity of being seen and heard, and having a chance to make a contribution.
And equality doesn't mean equal. Equality doesn't guarantee me a starting position on the Knicks. Equality means equality of access, the opportunity to do my best without being disqualified for irrelevant reasons.