MATLAB Questions and Answers – Three-Dimensional Plots

«
»

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Three-Dimensional Plots”.

1. How can we group the elements in a 3-d bar graph?
a) Give ‘grouped’ as style input to bar3() command
b) Give ‘grouped’ as style input to bar() command
c) Give ‘group’ as style input to bar3() command
d) Give ‘group’ as style input to bar() command
View Answer

Answer: a
Explanation: A 3-d bar graph is created with the bar3() command. The elements of each row of the input vector can be grouped together by giving a string input ‘grouped’ to the bar3() command.
advertisement

2. What is the size of the z vector in a mesh(x,y,z) if the sizes of x and y vectors are m, n respectively?
a) [m,n]
b) (m,n)
c) [m,n)
d) Independent of m and n
View Answer

Answer: a
Explanation: The size of the z vector is dependent on the size of the x and vectors. The permissible size lies between [m,n] and hence [m,n] is correct.

3. What is the purpose of the figure command?
a) Opens a blank window
b) Opens a blank window to draw graphs
c) Opens a window containing axes
d) Opens a window containing grid and axes
View Answer

Answer: b
Explanation: The figure command simply opens a separate blank window where new graphs are about to be plotted. It does not contain any axes or grid unless mentioned.

4. What is the range of co-ordinates obtained of the following code?

advertisement
advertisement
[x,y]=meshgrid(4)

a) 1:4 in x and y co-ordinates
b) 0:4 in x & y co-ordinates
c) only 4 in x and y co-ordinate
d) Error
View Answer

Answer: c
Explanation: Since the input is not a vector, only one co-ordinate will be assigned to both x and y. Hence only 4 will be assigned to x and y as the co-ordinate.
advertisement

5. What is the nature of z in surf(x,y,z)?
a) Integer
b) Vector
c) Matrix
d) String
View Answer

Answer: c
Explanation: The final input to the surf command, z, should be a matrix. The matrix is computed for each co-ordinate generated and given input interms of x and y.

6. What is the RGB triplet style for yellow?
a) [1 1 0]
b) [1 0 1]
c) [1 0 0]
d) [0 1 1]
View Answer

Answer: a
Explanation: The RGB triplet specifies the intensity of Red, Yellow and Green for a user-specified color input to the surf command. For yellow, it is defined in MATLAB as [1 1 0].
advertisement

7. What is the range of RGB triplets for the surf command?
a) [1 0]
b) [0 1]
c) (0 1)
d) (0 1]
View Answer

Answer: b
Explanation: The range of RGB triplets for the surf command is pre-defined in MATLAB as [0 1]. If any other value is given as input, MATLAB will give an error.

8. What is the short name for black as input to the surf command?
a) b
b) bl
c) k
d) blk
View Answer

Answer: c
Explanation: The short name for black has been defined in MATLAB as ‘k’. So to make the color black, we need to give k as input to the surf command.
advertisement

9. How do we create horizontal bar graphs in MATLAB?
a) bar3h()
b) barh()
c) bar3()
d) not possible
View Answer

Answer: a
Explanation: The Bar3() command plots vertical 3-D bar graphs. The bar3h() command plots horizontal bar graphs hence bar3h() is correct.

10. The meshc() command takes complex inputs.
a) True
b) False
View Answer

Answer: b
Explanation: The meshc() command does not take complex inputs. MATLAB will return an error if any such input is given.

11. colorbar command gives different color to the bar chart following their ______
a) height
b) width
c) length
d) independently
View Answer

Answer: a
Explanation: The height of the bar-chart gives a measure of the data being shown. The colorbar command gives different color to the bar chart following their height.

12. The ezsurf command is present in the ___________
a) Symbolic Math Toolbox
b) Statistics and Machine Learning Toolbox
c) Partial Differentiation Equation Toolbox
d) Neural Network Toolbox
View Answer

Answer: a
Explanation: The ezsurf command can be accessed from the Symbolic Toolbox. The rest of the Toolboxes does not have that command.

13. The color density of the bar-chart drawn from the bar3() command is always proportional to the height of the bars.
a) True
b) False
View Answer

Answer: b
Explanation: The following statement is not necessarily true. The color density can be made inversely proportional to the height of the bars by giving the direction of color density as reverse as an input to the bar3() command.

14. A stacked horizontal bar-chart can be made in MATLAB by ___________
a) Mentioning stacked as input to the bar3() command
b) Mentioning stacked as input to the bar3h() command
c) Mentioning stack as input to the bar3[] command
d) Mentioning stacked as input to the bar3h[] command
View Answer

Answer: b
Explanation: The bar3h() command is used to make a horizontal pie chart of a set of data. The bars can be stacked by giving ‘stacked’ as input to the command.

Sanfoundry Global Education & Learning Series – MATLAB.

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

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter