This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Plotting Multiple Curves”.

1. A student has created a plot of y(t)=t^{2}. He is need to show another graph of z(t)=t^{3} in the same plot. But every time he hits the plot() function- MATLAB generates a plot of z(t) vs t but on a different window. What is the error?

a) It is not possible to plot multiple plots

b) He is not using the line function

c) Maybe he is using stem() instead of plot()

d) He is not using the hold function

View Answer

Explanation: The hold command is used to hold the cursor, developed after creating a plot, so that the next graph, when plotted, will appear on the same window where the initial graph was plotted. He may use the line function, but in the code he is using the plot function. So he has to enter the function hold before plotting the graph of z(t).

2. Does the plot function take multiple arguments to a plot?

a) True

b) False

c) Sometimes

d) Only if the functions are in time domain

View Answer

Explanation: The plot function can take multiple input arguments to plot multiple graphs. This is an inbuilt function so the nature of the function is, inherently, to take multiple arguments if the arguments are defined.

3. What happens if we don’t stop the implementation of the hold function?

a) Nothing happens

b) MATLAB keeps on generating multiple plots in the same window

c) Error is generated

d) Plot function won’t work

View Answer

Explanation: Suppose we plot 2 graphs on the same window by using the hold command. If we don’t stop the implementation of the hold function, MATLAB will keep on generating plots on the same window. So the user won’t get a separate plot if he wants.

4. Is histogram a kind of multiple plots?

a) True

b) False

c) Cannot be determined

d) There is no such thing called Histogram

View Answer

Explanation: We are plotting a particular data set for different entities. The data set may comprise of the same set but each entity is inherently independent from each other. So, we are plotting multiple functions of the same variables. Hence, the histogram is a kind of multiple plots.

5. The function to plot vector fields is ___________

a) quiver()

b) pie3

c) ezplot()

d) contour()

View Answer

Explanation: The function ‘quiver()’ is a pre-defined function in MATLAB. It is often used to plot vector fields in MATLAB. The pie3 function is used to plot a 3-d pie plot. The ezplot() generates a 3d plot while the contour() is used to generate the contour plot of a specified matrix.

6. How to introduce a title to describe the subplots generated in MATLAB?

a) Use a function

b) Use the title function

c) Use the legend function

d) Use uipanel()

View Answer

Explanation: The uipanel can be used to give a major title to the subplots created. The title name is given as a string input by the following way:

f=figure;

c=uipanel(‘Parent’,f,’BorderType’,’none’);

c.Title=’Title Name’;

c.TitlePosition=’centertop’

7. Can we have multiple 3d plots in MATLAB?

a) Yes

b) No

c) Maybe

d) Cannot be determined

View Answer

Explanation: The plot3() function is a pre-defined function in MATLAB. So, it will allow the use to generate multiple 3d plots. This is inherent to the system.

8. The student receives an error while trying to plot multiple graphs using the hold command. What is there error if there is no a syntactical error?

a) Cannot be determined

b) The plot function is not defined with a constant variable range

c) There is no hold command

d) There has to be a syntactical error only

View Answer

Explanation: If the student is using the hold command, the student has to keep the scale and range of one axis same. Then he can plot the functions of other dependent variables, which depend on the independent variable range previously defined. If the plot function contains an entirely different set of arguments, MATLAB will produce an error.

9. What is the difference between hold on and hold all?

a) no difference

b) hold all holds every plot while hold on holds a specific plot in the chain of argument

c) hold all does not exist

d) hold on is syntactically incorrect

View Answer

Explanation: Both hold on and hold all commands are used to hold the graph of a function. There is no difference between them. To avoid confusion, one can only write hold to hold a graph and again enter the command hold to release the graph.

10. What is the purpose of the line command if the plot command can be used to directly accept the arguments and generate a plot?

a) Saves complexity

b) We can refrain from using the hold function

c) There is no separate, definite purpose

d) Cannot conclude

View Answer

Explanation: The use of the line command is primarily seen in plotting the graphs without the hold command. But we can put the arguments within the plot command itself so that we don’t have to put an extra line of code. This saves complexity, although we have increased the length of our code.

**Sanfoundry Global Education & Learning Series – MATLAB.**

To practice all areas of MATLAB, __here is complete set of 1000+ Multiple Choice Questions and Answers__.

**Next Steps:**

- Get Free Certificate of Merit in MATLAB
- Participate in MATLAB Certification Contest
- Become a Top Ranker in MATLAB
- Take MATLAB Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

**Related Posts:**