2D and 3D Plotting Flashcards
7 cards from real MATLAB practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 2D and 3D Plotting flashcards as text
Which MATLAB function creates a filled contour plot?
Answer: contourf
contourf() creates a contour plot with filled regions between contour lines, using color to indicate value ranges.
What does the 'subplot(2,3,4)' command do in MATLAB?
Answer: Creates a 2x3 grid and activates the 4th panel (second row, first column)
subplot(m,n,p) divides the figure into an m-by-n grid and makes the p-th subplot the active one, counting left to right, top to bottom.
Which function would you use to create a 3D scatter plot in MATLAB?
Answer: scatter3
scatter3(x,y,z) plots data as 3D markers at the coordinates specified by x, y, and z vectors.
In MATLAB, what does the format string 'r--' specify in a plot command?
Answer: Red dashed line
In the format string 'r--', 'r' specifies the color red and '--' specifies a dashed line style.
Which MATLAB function returns a handle to the current axes?
Answer: gca
gca() (Get Current Axes) returns the handle to the current axes object, which can then be used to modify axes properties.
What is the purpose of the 'meshgrid' function before creating a 3D surface plot?
Answer: It creates 2D grid matrices of x and y coordinates needed for evaluating z = f(x,y)
meshgrid(x,y) transforms coordinate vectors into 2D arrays so that every (x,y) combination can be used to compute z values for surface plots.
Which MATLAB command changes the current figure's background color to white?
Answer: set(gcf, 'Color', 'white')
set(gcf, 'Color', 'white') sets the Color property of the current figure (gcf) to white.