1. How would you plot multiple graphs in MATLAB?
a) Using the hold function
b) Using the mplot function
c) Using the mstem function
d) It cannot be done in MATLAB
Explanation: The hold command is a pre-defined function in MATLAB. It allows the control to remain in the window where which was generated by MATLAB, the first time we type a command to plot any kind of graph. Then on we can plot multiple graphs on the same window.
2. How do you show the program of an MAT file?
a) The program should contain the echo command
b) The program should contain the showprog command
c) The program should contain the diary command
d) The program cannot be shown while running a MEX file
Explanation: MEX files are not M-files. They are binary files which store the values of variables present in the workspace. So there is no question of showing the program of a MAT file.
3. The help command works only for a pre-defined function in MATLAB.
Explanation: The help command will only show the nature of functions of any command which is already existing in the MATLAB directory. If we want to show the purpose of our written function, we have to add comments in our m-file and then enter the echo command.
4. What is the equivalent of subplot (1, 1, 1)?
c) It is not possible
Explanation: While using subplot (1,1,1), we have allocated memory as a 2-D matrix for only 1 graph. This is similar to the axes command which generates an empty graph. This is pre-defined in MATLAB.
5. It is not possible to store graphs as MAT-file.
Explanation: MAT files save data from the workspace. A graph, plotted among different variables, cannot be stored in MATLAB since MAT-files are files used to store values from the workspace.
6. The command used to reflect the files from a disk into the workspace is _______
d) it is not possible
Explanation: The load function is pre-defined in MATLAB. It is used to load variables and/or data from the disk to the workspace.
7. The format for 5 digit representation along with exponent is __________
a) short e
b) short g
c) short exp
d) 4 digit along with exponent value can be represented
Explanation: The short e format is used to represent a result with 5 digits and an exponent term. Now, this is pre-defined in MATLAB. Short g and short exp are not present in MATLAB. We cannot use a representation of 4 digits and an exponent as it is not defined in MATLAB, as of yet.
8. Which operator is used to prevent the printing of insignificant zeros?
d) It is not possible
Explanation: %g is used to represent any number, which has a fixed number of digits or a number with an exponent, with no insignificant zeros. This is present in the MATLAB directory only.
9. The function to plot a graph with both axes on logarithmic scales is __________
d) not possible
Explanation: There is no command called semilog or log to plot a graph with logarithmic scales. However, we have the loglog function, pre-defined in MATLAB, which allows us to plot a graph of two variables where both the variables are scaled logarithmically.
10. We cannot plot a discrete and continuous relationship in the same graph.
Explanation: We can plot a discrete and continuous relationship in the same graph. We have to use the hold command and change the scaling of the variables a bit if at all needed, so that the discrete and continuous relationship looks prominent enough in the same graph. We have to use the hold command efficiently.