Vital MATLAB Interview Preparation Guide Download PDF
MATLAB Interview Questions and Answers guide to educate about the Matlab is a numerical computing environment and programming language. You will learn in Matlab Interview Questions and Answers that MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation.
47 MATLAB Questions and Answers:
Table of Contents:
1 :: A question about matlab function
i have used diff(y,x) for a function in matlab and it has give me a answer that has abs(a,b) in it.
wht is this function according to its two arguments?
ali 08-1-2016?
diff(y) means calculates differences between adjacent elements of y along the first array dimension
y= [1 1 2 3 5 8 13 21];
z=diff(y)
z =
0 1 1 2 3 5 8
this is the difference between the adjacent columns (second column-first column) and the result of diff function that is number of column of z is one less than the number of column of y
diff(y,x) where x=2
diff function will call two times (x times)
y= [1 1 2 3 5 8 13 21];
x=2;
z=diff(y,x)
z= 1 0 1 1 2 3
number of column of z is two less than y
y= [1 1 2 3 5 8 13 21];
z=diff(y)
z =
0 1 1 2 3 5 8
this is the difference between the adjacent columns (second column-first column) and the result of diff function that is number of column of z is one less than the number of column of y
diff(y,x) where x=2
diff function will call two times (x times)
y= [1 1 2 3 5 8 13 21];
x=2;
z=diff(y,x)
z= 1 0 1 1 2 3
number of column of z is two less than y
2 :: How can i simulate a 2 phases voltage dip in simulink/matlab?
You need to use Simulink Simpower toolbox and voltage source. Use any RL branch as load and add acircuit breaker between source and load to create voltage dip at specified simulation time.
3 :: What is MEX in MATLAB?
They are basically native C or C++ files which are linked directly into the MatLab application at runtime. MEX files have efficiency to crash the MatLab application
4 :: Do you know what is Get and Set in Matlab?
Get and Set are referred as getter and setter functions. For assigning properties, setter functions are used while for accessing properties getter functions are used.
5 :: What common toolboxes present in Matlab?
Some of the common toolboxes in Matlab are
► Control System
► Fuzzy Logic
► Image Processing
► LMI control
► Neural Networks
► Robust Control
► System Identification
► Control System
► Fuzzy Logic
► Image Processing
► LMI control
► Neural Networks
► Robust Control
► System Identification
6 :: What are M-file?
They are just a plain ASCII text that is interpreted at run time. They are like sub-programs stored in text files with .m extensions and are called M-files. For most of the MatLab, development M-files are used.
7 :: What graphic system used in MatLab?
Graphic system used in MatLab is known as handle graphics. It has a high level and low-level commands.
► High Level Commands: High level command performs image processing, data visualization and animation for 2D and 3D presentation graphics
► Low Level Commands: Full customization of the appearance of graphics and building of complete graphical user interface
► High Level Commands: High level command performs image processing, data visualization and animation for 2D and 3D presentation graphics
► Low Level Commands: Full customization of the appearance of graphics and building of complete graphical user interface
8 :: What are Xmath features?
► Scripting language with OOP features
► Libraries that are LNX and C language compatible
► A debugging tools with GUI features
► Color graphics can be pointed and clickable
► Libraries that are LNX and C language compatible
► A debugging tools with GUI features
► Color graphics can be pointed and clickable
9 :: Do you know what are the four basic functions to solve Ordinary Differential Equations?
The four basic functions that MatLab has to solve ODE's are
► Quad
► Quad8
► ODE23
► ODE45
► Quad
► Quad8
► ODE23
► ODE45
10 :: Do you know what is Simulink?
Simulink is an add-on product to MatLab, it provides an interactive, simulating, graphical environment for modeling and analyzing of dynamic systems.
11 :: What are the operators that MatLab allows?
Matlab allows following Operators
► Arithmetic Operators
► Relational Operators
► Logical Operators
► Bitwise Operations
► Set Operations
► Arithmetic Operators
► Relational Operators
► Logical Operators
► Bitwise Operations
► Set Operations
12 :: Do you know what are the types of loops does Matlab provides?
Matlab provides loops like
► While Loop
► For Loop
► Nested Loops
► While Loop
► For Loop
► Nested Loops
13 :: Do you know MatLab consist of what?
MatLab consists of five main parts
► MatLab Language
► MatLab working environment
► Handle Graphics
► MatLab function library
► MatLab Application Program Interface (API)
► MatLab Language
► MatLab working environment
► Handle Graphics
► MatLab function library
► MatLab Application Program Interface (API)
14 :: What is Xmath?
Xmath is an interactive scripting and graphics environment for Xwindow workstations.
► With its significant improvement features on MATLAB-type software, interactive mathematics, scripting functionalities are elaborated.
► Following are the Xmath features:
► Sripting languages with OOP features.
► Libraries that are LNX and C language compatible.
► A debugging tools with GUI features.
► Color graphics can be pointed and clickable.
► A special layer is available that is programmable for MOTIF GUI.
► With its significant improvement features on MATLAB-type software, interactive mathematics, scripting functionalities are elaborated.
► Following are the Xmath features:
► Sripting languages with OOP features.
► Libraries that are LNX and C language compatible.
► A debugging tools with GUI features.
► Color graphics can be pointed and clickable.
► A special layer is available that is programmable for MOTIF GUI.
15 :: What is image arithmetic functions in MATLAB?
Following is the list of image arithmetic functions and their usage.
► Imabsdiff - Returns absolute difference of two images.
► Imadd - Performs addition of two images or addition of constant to image.
► Imapplymatrix - Applies linear combination of color channels.
► Imcomplement - Complements an image.
► Imdivide - Divide one image into another or divide image by constant.
► Imlincomb - Linear combination of images.
► Immultiply - Multiplies two images or multiplies image by constant.
► Imsubtract - Subtracts one image from another or subtracts constant from image.
► Imabsdiff - Returns absolute difference of two images.
► Imadd - Performs addition of two images or addition of constant to image.
► Imapplymatrix - Applies linear combination of color channels.
► Imcomplement - Complements an image.
► Imdivide - Divide one image into another or divide image by constant.
► Imlincomb - Linear combination of images.
► Immultiply - Multiplies two images or multiplies image by constant.
► Imsubtract - Subtracts one image from another or subtracts constant from image.
16 :: Tell me can MATLAB run without graphics?
At times scripts need to run without displaying the plots.
► By doing this, the script statement need not be commented.
► When working from home, running graphics over the network may be too slow.
► To perform the process, add the following lines of code:
%setenv DISPLAY /dev/null % MATLAB.
► By using these simple tricks, we can run MATLAB without graphics.
► By doing this, the script statement need not be commented.
► When working from home, running graphics over the network may be too slow.
► To perform the process, add the following lines of code:
%setenv DISPLAY /dev/null % MATLAB.
► By using these simple tricks, we can run MATLAB without graphics.
17 :: Do you know how to correctly apply the graphics patches in MATLAB?
Following is the sequence of commands to apply graphic patches in MATLAB.
► Open the LOCAL MACHINE window.
► Type the command xhost + ashland.
► Add the following code sequence before the plot command.
Figure;
Set(gcf,'renderer','zbuffer');
[s,w] = unix('echo $DISPLAY');
Set(gcf, 'XDisplay',w);
► Open the LOCAL MACHINE window.
► Type the command xhost + ashland.
► Add the following code sequence before the plot command.
Figure;
Set(gcf,'renderer','zbuffer');
[s,w] = unix('echo $DISPLAY');
Set(gcf, 'XDisplay',w);
18 :: Do you know what is LaTeX in MATLAB?
MATLAB allows Greek letters.
► These letters are to be encoded.
► To encode these Greek letters, LaTeX is used.
MATLAB already handles naturally simple LaTeX encodings that allow introducing Greek lettters or modifying the font size and appearance in plots.
► These letters are to be encoded.
► To encode these Greek letters, LaTeX is used.
MATLAB already handles naturally simple LaTeX encodings that allow introducing Greek lettters or modifying the font size and appearance in plots.
19 :: Suppose if you know then tell me how to call MATLAB in batch mode?
Batch mode execution of MATLAB can be done from command line or from makefile.
► A script is needed with extension .m.
► Specify all the commands that are to execute in sequential order in the script.
► The commands are placed in the script by using the command makefile
► To add the commands in command line mode, type all the commands at the command line in sequential order.
► The commands are executed soon after typing them at the command line.
► A script is needed with extension .m.
► Specify all the commands that are to execute in sequential order in the script.
► The commands are placed in the script by using the command makefile
► To add the commands in command line mode, type all the commands at the command line in sequential order.
► The commands are executed soon after typing them at the command line.
20 :: What is memory management functions in MATLAB?
Below is the list of memory management functions.
► Clear - Removes variables from memory.
► Pack - Saves the existing variables to disk, and then reloads them contiguously.
► Save - Selectively persists variables to disk.
► Load - Reloads a data file saved with the save function.
► Quit - Exits MATLAB and returns all allocated memory to the system.
► Clear - Removes variables from memory.
► Pack - Saves the existing variables to disk, and then reloads them contiguously.
► Save - Selectively persists variables to disk.
► Load - Reloads a data file saved with the save function.
► Quit - Exits MATLAB and returns all allocated memory to the system.
21 :: Do you know how to Pre Allocate a Non Double matrix?
Preallocating a block of memory for holding a non double matrix is memory efficient.
► It is faster to use the function 'repmat'.
► While allocating block of memory for a matrix, zeros are pre allocated to a matrix.
► The function to pre allocate memory is int8().
Ex: matrix = int8(zeros(100));
► Repmat function is used to create a single double matrix.
► Ex: matrix2 = repmat(int8(0), 100, 100);
► Thus non double matrix is pre allocated.
► It is faster to use the function 'repmat'.
► While allocating block of memory for a matrix, zeros are pre allocated to a matrix.
► The function to pre allocate memory is int8().
Ex: matrix = int8(zeros(100));
► Repmat function is used to create a single double matrix.
► Ex: matrix2 = repmat(int8(0), 100, 100);
► Thus non double matrix is pre allocated.
22 :: What are the Basic Plots and Graphs of MATLAB?
Following table describes basic plots and graphs.
► Box - Axis border
► Errorbar - Plots error bars along curve
► Hold - Retains current graph while adding new graphs
► Line - Creates line object
► LineSpec (Line Specification) - Syntax of Line Specification String
► Loglog - Log to log scale plot
► Plot - 2-D line plot
► Plot3 - 3-D line plot
► Plotyy - 2-D line plots with y-axis on both left and right side
► Polar - Polar coordinate plot
► Semilogx - Semilogarithmic plot
► Semilogy- Semilogarithmic plot
► Subplot- Creates axis in tiled positions
► Xlim - Sets or queries x-axis limits
► Ylim - Sets or queries y-axis limits
► Zlim - Sets or queries z-axis limits
► Box - Axis border
► Errorbar - Plots error bars along curve
► Hold - Retains current graph while adding new graphs
► Line - Creates line object
► LineSpec (Line Specification) - Syntax of Line Specification String
► Loglog - Log to log scale plot
► Plot - 2-D line plot
► Plot3 - 3-D line plot
► Plotyy - 2-D line plots with y-axis on both left and right side
► Polar - Polar coordinate plot
► Semilogx - Semilogarithmic plot
► Semilogy- Semilogarithmic plot
► Subplot- Creates axis in tiled positions
► Xlim - Sets or queries x-axis limits
► Ylim - Sets or queries y-axis limits
► Zlim - Sets or queries z-axis limits
23 :: What are 3D visualization elements in MATLAB?
3D visualization elements allow MATLAB to deal with 3D graphics.
► Surface and Mesh Plots - It includes plot matrices, visualize functions, color maps.
► View Control - Used to control camera viewpoint, rotation, zooming, and aspect ratio and set axis limits.
► Lighting - Used for adding and controlling scene lighting.
► Transparency - Used to specify object transparency.
► Volume Visualization - Used for volume data grid.
► Surface and Mesh Plots - It includes plot matrices, visualize functions, color maps.
► View Control - Used to control camera viewpoint, rotation, zooming, and aspect ratio and set axis limits.
► Lighting - Used for adding and controlling scene lighting.
► Transparency - Used to specify object transparency.
► Volume Visualization - Used for volume data grid.
24 :: What is handle graphics in MATLAB?
Handle Graphics is a subsystem of MATLAB that handles graphics.
► Handle Graphics has high level commands for 2D and 3D data visualization.
► Image processing, animation and presentation graphics can be generated using Handle Graphics.
► Low level commands allow customizing the graphics appearances.
► Handle Graphics allows to build customized Graphics User Interfaces
► Handle Graphics has high level commands for 2D and 3D data visualization.
► Image processing, animation and presentation graphics can be generated using Handle Graphics.
► Low level commands allow customizing the graphics appearances.
► Handle Graphics allows to build customized Graphics User Interfaces
25 :: What is stress analysis in MATLAB?
MATLAB is used in aerospace engineering, space environment.
► MATLAB is suitable for flexible dynamics.
► These domain experts conduct stress analysis on various structures like metallic and composite structures.
► To analyze the stress, NASTRAN, IDEAD, Oracle and PATRAN levels of proficiency is needed.
► The tasks are also used on aircraft that is metallic structure.
► The stress analysis includes control surface stiffness understanding, loop calculations, finite element modeling and fatigue testing requirement and analysis.
► MATLAB is suitable for flexible dynamics.
► These domain experts conduct stress analysis on various structures like metallic and composite structures.
► To analyze the stress, NASTRAN, IDEAD, Oracle and PATRAN levels of proficiency is needed.
► The tasks are also used on aircraft that is metallic structure.
► The stress analysis includes control surface stiffness understanding, loop calculations, finite element modeling and fatigue testing requirement and analysis.