CS112: Lab 5 :: Review for Exam 1 answers

variables & MATLAB vectors & conditionals matrices & images plotting grab bag
fish = 1 turkeys= [ 6 10 12 0 18] 1) [3 1; 5 6]
2) ans =
 3    2
 1    5
The x and y scales are in the same units (not necessarily the same range) in a given plot lucky has no value, an error message is generated since the code tried to access a negative position in a vector
51 any(shoesizes == mean(shoesizes)) matA =
[ 5 5 5 10;
0 2 -35 2;
-25 5 8 10]
Click here for plot error because lemons and limes are not the same size
0 yankees
cubs
days(sum(data) == max(sum(data))) error: plot1 not recognized (legend needs plot handles) grades(grades==max(grades)) = 0;
max(grades);
OR
max(grades(~(grades == max(grades))))
disp(['Nice to meet you, ' name ', have a nice day!']) bubba = [2 6 10 12 6 10] sideways =
W(:, end:-1:1,:);
imshow(sideways)
Grenade: Bruno Mars
Firework: Katy Perry
Born This Way: Lady Gaga
canvas = ones(125,125);
% add vertical stripes to canvas
canvas(1:end,26:50) = block;
canvas(1:end,76:100) = block;
% add horizontal stripes
canvas(26:50,:) = block';
canvas(76:100,:) = block';
imshow(canvas);