Complete the code to plot two lines on the same figure.
x = 1:5; y = x.^2; plot(x, y); hold [1]; y2 = x.^3; plot(x, y2);
Using hold on allows multiple plots on the same figure without erasing the previous plot.
Complete the code to plot a sine and cosine on the same graph.
x = linspace(0, 2*pi, 100); plot(x, sin(x)); hold [1]; plot(x, cos(x));
hold on keeps the first plot so the second plot appears on the same axes.
Fix the error in the code to plot two lines without erasing the first.
x = 0:0.1:1; plot(x, x); hold [1]; plot(x, x.^2);
The correct command is hold on to keep the first plot visible.
Fill both blanks to plot three lines on the same figure.
x = 1:4; plot(x, x); hold [1]; plot(x, x.^2); hold [2]; plot(x, x.^3);
Using hold on before the second plot keeps the first plot visible, and hold off before the third plot releases the hold so the third plot replaces the previous plots.
Fill all three blanks to create a figure with multiple plots and then release hold.
x = 0:pi/4:2*pi; plot(x, sin(x)); hold [1]; plot(x, cos(x)); hold [2]; plot(x, tan(x)); hold [3];
Use hold on to add plots without erasing, then hold off to release hold.