ENES101 zyBooks Chapter 7.1 - 7.2
line plot
A _____________ connects data points by line segments.
*
Asterisk
blue
Color plot specifiers. b
cyan
Color plot specifiers. c
green
Color plot specifiers. g
black
Color plot specifiers. k
magenta
Color plot specifiers. m
red
Color plot specifiers. r
white
Color plot specifiers. w
yellow
Color plot specifiers. y
cos(2 * xVals)
Complete the statement to calculate> the yVals1-values for the top plot. xVals = linspace(-0.01, 3*pi, 100); subplot(2, 1, 1); yVals1 =__________________; plot(xVals/pi, yVals1)
[-.01, 3.01, -1.1, 1.1]
Complete the statement to set the plot x-axis from -.01 to 3.01 and the y-axis from -1.1 to 1.1. axis(_______________________);
x
Cross
d
Diamond
v
Downward-pointing triangle
p
Five-pointed star (pentagram)
<
Left-pointing triangle
plot
Line plot
semilogy
Line plot with linear x and logarithmic y axes
semilogx
Line plot with logarithmic x and linear y axes
loglog
Line plot with logarithmic x and y axes.
plotyy
Line plots with y-axes on both left and right side
.
Point
>
Right-pointing triangle
h
Six-pointed star (hexagram)
s
Square
stairs
Stairstep graph
plot(x, m*x + b)
Suppose x is a row array, m is a scalar variable equal to the slope of a line, and b is a scalar variable equal to the y-intercept. Write a statement that plots the line determined by the given x, m, and b:
xlabel, ylabel, title function
The _________, ___________, and __________________s allow a programmer to set the name of the x-axis, y-axis, and plot title, respectively.
subplot(2, 1, 1)
The first command is to declare that a combined figure will be made consisting of two plots stacked vertically on top of each other and plot will be drawn at position 1. Give this command. xVals = linspace(-0.01, 3*pi, 100); ____________________________;
True The array lengths must be equal; together the arrays represent the x/y values of a sequence of points.
The following command generates an error because the array lengths differ: plot( [2, 4, 6], [99, 88] )
False The plotted points are (2,4), (5,6), and (3,7). No error is generated, but the plot's lines will connect (2,4) with (5,6), and (5,6) with (3,7), causing a zigzag appearance (like the shape >).
The following command generates an error because the x points are not in ascending order:
False All x values must be in first array, y values in second: plot( [10, 20], [99, 88] ).
The following command plots the points (10, 99) and (20, 88): plot([10, 99], [20, 88])
False The array with x values must appear first: plot( [100, 200], [55, 45]).
The following command plots the points(100, 55) and (200, 45): plot([55, 45], [100, 200])
axis
The programmer can set the x and y-axis limits using the_____ command.
graph
The resulting graphical representation is commonly called a plot or ___________.
plot(xvals, yvals, 'o')
Type arrays as [1, 2, 3]. Type text as 's'. Type the command to plot the points stored in arrays xvals and yvals, drawing points as circles and with no line segments.
xlabel('Speed')
Type arrays as [1, 2, 3]. Type text as 's'. Type the command to set the x-axis label to: Speed.
axis([5, 10, 0, 100])
Type arrays as [1, 2, 3]. Type text as 's'. Type the command to set the x-axis limits from 5 to 10 and y-axis limits from 0 to 100.
plot( [10, 2, 5] )
Type plot commands in the form: plot([5, 9, 2]...). Type the plot command to plot data values (1, 10), (2, 2), and (3, 5) by using only one row array.
plot([2, 4, 6], [5, 8, 7])
Type plot commands in the form: plot([5, 9, 2]...). Type the plot command to plot points (2, 5), (4, 8), and (6, 7). Use two arrays.
^
Upward-pointing triangle
plot(x, m*x + b, 'c')
Write a statement that plots a cyan line for a row array x, slope m, and intercept b.
plot(x, m*x + b, 'c--', 'LineWidth', 3)
Write a statement that plots a row array x, slope m, and intercept b as a cyan dashed line with line width 3.
plot(xVals/pi, yVals2)
Write a statement to output the bottom plot. yVals2 = 0.5 * (abs(cos(2 * xVals)) - cos(2 * xVals));
subplot(2, 1, 2)
Write a statement to select the plot for the bottom figure of the 2 vertically stacked plots
plot
______________ means to represent data graphically.
grid
adds a grid to the plot
hold on
allows multiple plots to be superimposed on the same axes
text
allows placing text at specified coordinates of the plot
gtext
allows positioning of text with the mouse
0 to 10; 5 to 50
axis([0, 10, 5, 50]) sets the x-axis to range from __________, and the y-axis from _________. The axis command should be applied after the plot command.
close(n)
closes figure number n
subplot(a, b, c)
creates an a x b matrix of plots with c the current figure
-.
dashdot
--
dashed
:
dotted
xlabel
labels the x-axis
ylabel
labels the y-axis
figure(n)
makes figure number n the current figure
(none)
no line
Circle
o
hold off
releases hold on current plot and allows a new graph to be drawn
axis
sets the aspect ratio of x and y axes, ticks etc.
title
sets the graph title
-
solid
orient
specifies the orientation of a figure