1. Explain What is Matlab?
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. Typical uses include:
- Math and computation
- Algorithm development
- Modeling, simulation, and prototyping
- Data analysis, exploration, and visualization
- scientific and engineering graphics
- Application development, including graphical User interface building
2. What are the Matlab system parts?
the MATLAB system consists of five main parts:
- the MATLAB language.
- the MATLAB working environment.
- Handle graphics.
- the MATLAB mathematical function library.
- the MATLAB Application Program interface (API).
3. What is the Matlab language?
This is a high level matrix/array language with control flow statements, functions, data structures,input/output, and object oriented programming features. it allows both “programming in the small” to rapidly create quick and dirty throw away programs, and “programming in the large” to create complete large and complex application programs.
4. What is the Matlab Working Environment?
This is the set of tools and facilities that you work with as the MATLAB user or programmer. it includes facilities for managing the variables in your work space and importing and exporting data. it also includes tools for developing, managing, debugging, and profiling Mfiles, MATLAB’s applications.
5. Define handle graphics in Matlab?
This is the MATLAB graphics system. it includes high level commands for two dimensional and three dimensional data visualization, image processing, animation, and presentation graphics. it also includes low level commands that allow you to fully customize the appearance of graphics as well as to build complete graphical User interfaces on your MATLAB applications.
6. What is the Matlab Mathematical Function Library?
This is a vast collection of computational algorithms ranging from elementary functions like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transforms.
7. What is the Matlab application program interface(api)?
This is a library that allows you to write C and Fortran programs that interact with MATLAB. it include facilities for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing MATfiles
8. How to add noise to an image in Matlab?
the function noise.m, now installed on ashland too, adds Gaussian, uniform, salt and pepper,additive or multiplicative noise to an image.
9. What Can We Use Matlab For?
- simple calculations
- Plotting and analyzing mathematical relationships (2D and 3D)
- List & Matrix Operations
- Writing script files (a type of programming)
- symbolic manipulation of equations
- Advanced visualization, animation and GUI interface tools
10. Vectorization What is that in Matlab?how to do it?
Thinking is terms of full matrices/vectors and also some related functions for that * Use of filter(), which works beautifully for some time series models
11. On What Machines Matlab should Be Run?
We will run it from sthelens, and only if sthelens is down, from cher, orsay or tiree. it works on other machines too, but some of the other machines have older versions of the Os and core dump upon exiting from matlab. some other local machines with new setups work fine. Try your local machine. Matlab is blocked from running on the servers
12. What is latex in Matlab?
Matlab already handles naturally simple LaTeX encodings that allow introducing Greek lettters or modifying the font size and appearance in plots.
13. Can we run Matlab with out graphics?
sometimes you may want to run scripts which contain plotting commands without displaying the plots and without going into the script to comment out the commands.
an example: if you’re working from home and it’s too slow to run graphics over the network.You can play a simple UNIX trick:
%setenv DisPLAY /dev/null % matlab
14. How to correctly apply the graphics patches in Matlab?
Open a LOCAL MACHinE window and type: xhost +ashland # Add the following code sequence just before the plot command that was giving you problems: figure? set(gcf,’renderer’,’zbuffer’)? [s,w] = unix(‘echo $DisPLAY’)? set(gcf,’XDisplay’,w)?
15. How to call Matlab in batch mode?
This can be done from the command line or from a makefile. You need a script (filename.m). Just type at the command line, or include in the makefile: matlab
16. Define about stress analysis in Matlab?
People working on these areas as a aerospace engineers should have familiarity and exposure to NAsTRan and MATLAB with knowledge on space environment and modeling of flexible dynamics.these aerospace engineers will be responsible to conduct stress analysis on metallic and composite structures. NAsTRan, IDEAD, Oracle and PATRan proficiency level is required. their duties also include on aircraft which are metallic and composite structures. This includes and understanding of control surface stiffness and loop calculations, finite element modeling (FEM),fatigue testing requirement and analysis.
17. 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
18. 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
19. Do you know what is simulink?
simulink is an addon product to MatLab, it provides an interactive, simulating, graphical environment for modeling and analyzing of dynamic systems.
20. What are the operators that Matlab allows?
Matlab allows following Operators
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operations
- set Operations
21. Do you know what are the types of loops does Matlab provides?
Matlab provides loops like
- While Loop
- For Loop
- Nested Loops
22. 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)
23. What is xmath?
Xmath is an interactive scripting and graphics environment for Xwindow workstations.
- With its significant improvement features on MATLABtype 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.
24. 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.
25. Tell We 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.
26. 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);
27. 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.
28. 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.
29. 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.
30. 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.
31. 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
32. 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.
33. 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
34. 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.
35. Explain Matlab mathematical function library?
MATLAB mathematical functions include computational algorithms.
- the elementary computational functions are sum, sine, etc.
- Matrix functions are available including matrix inversion.
- special functions like Bessel are available.
- MATLAB includes transformation functions, namely Fourier Transformation Functions.
36. What is Matlab working environment?
MATLAB working environment has various tools to work with MATLAB.
- it has facilities to manage variables.
- MATLAB supports export and import data across applications.
- Certain tools are available to develop and manage MATLAB files.
- Debugging and profiling of MATLAB applications are more flexible with MATLAB
37. Explain about Matlab language?
MATLAB language is a high-level matrix language.
- it has control structures, functions, data structures, I/O and OOP features.
- Allows rapid creation of throw-away programs.
- Allows creating large and complex application programs.
- MATLAB API allows to author C and FORTRan programs to interact with MATLAB.
38. Do You Know about Matlab system parts?
Following are the 5 main parts of MATLAB.
- MATLAB Languange.
- MATLAB working environment.
- graphics handler.
- MATLAB mathematical library.
- MATLAB Application Program interface.
39. What is pseudo random binary sequence and numeric precision in Matlab?
pseudo random binary sequence : A form of generating an M-file in the new Frequency Domain system Identification toolbox, for a specified set of lengths (2^2-1 to 2^30-1) is called pseudo random binary sequence. it is also known as mlbs (for Maximum Length Binary sequence).
numeric precision : Numeric quantities which are represented as double precision floating point numbers is called numeric precision. On most computers, such numbers have 53 significant binary bits, which is about 15 or 16 decimal digits.
40. Which graphic system is Used in Matlab? Explain it.
- the graphic system which is used in Matlab is known as handle graphics. it has few high level and low level commands.
- High level commands performs data visualization, image processing, and animation for two dimensional and three dimensional presentation graphics.
- Full customization of the appearance of graphics and building of complete graphical user interfaces on is done by low level commands in MATLAB applications.
1. What does Matlab stand for? | MatLab Mcqs
a) Math Laboratory
b) Matrix Laboratory
c) Mathworks
d) Nothing
e) none of the above
Ans: b
2. What symbol precedes all comments in Matlab? | MatLab Mcqs
a) “
b) %
c) //
d) <
e) none of the above
Ans: e
3. Which of the following is not a pre-defined variable in Matlab. | MatLab Mcqs
a) pi
b) inf
c) i
d) gravity
e) j
Ans: d
4. This Matlab command clears all data and variables stored in memory: | MatLab Mcqs
a) clc
b) clear
c) delete
d) deallocate
e) none of the above
Ans: b
5. Characters in Matlab are represented in their value in memory. | MatLab Mcqs
a) decimal
b) ASCII
c) hex
d) string
e) none of the above
Ans: b
6. Which is these is not an aspect of a for/while loop: | MatLab Mcqs
a) update
b) initialization
c) runner
d) condition
e) all are aspects of loops
Ans: c
7. To better manage memory and prevent unnecessary memory allocations, Matlab uses: | MatLab Mcqs
a) vectors
b) scalars
c) matrix math
d) delayed copy
e) licenses
Ans: d
8. To print a newline in a fprintf statement, you must use the following escape character: | MatLab Mcqs
a) \t
b) \nl
c) \nxt
d) \n
e) none of the above
Ans: d
9. In Matlab, this keyword immediately moves to the next iteration of the loop: | MatLab Mcqs
a) update
b) goto
c) continue
d) break
e) none of the above
Ans: c
10. Which of the following will correctly define x, y, and z as symbols? | MatLab Mcqs
a) sym (x, y, z)
b) syms x y z
c) syms x, y, z
d) sym x, y, z
e) none of the above
Ans: b
11. Which of these is the way to access the first element in a vector named v (assuming there is at least one element in the vector)? | MatLab Mcqs
a) v(0)
b) v(1)
c) v
d) v(: , 0)
e) none of the above Ans: b
12. Which of the following is used to see if two elements are equal in MATLAB? | MatLab Mcqs
a) !=
b) ==
c) isequal
d) =
e) none of the above
Ans: b
13. If vector = [1 2 3 4; 11 24 92 100; 345 65 90 1]. What will the value of a be equal to if this code is entered into MATLAB >>[a b] = size (vector)? | MatLab Mcqs
a) 1 2 3 4
b) 12
c) 1
d) 4
e) 3
Ans: e
14. What is the value of ans that is printed when the following code is run: isnumeric(32) | MatLab Mcqs
a) 1
b) 0
c) 32
d) yes
e) true
Ans: a
15. If I want to save a formatted string to memory, but don’t want to print it out, which command should I use? | MatLab Mcqs
a) fprintf
b)sprintf
c) disp
d) echo
Ans: b
16.?Executing?in?the?Command?Window?the?following?code
? ?a?=?(1:3)’ ?;??(a(1,2))’?
? returns??
a.? error?message?
b.? 1???
c.? 2?
d.? 1????2?
e.? none?of?above?
Ans: a
17.?Executing?in?the?Command?Window?the?following?code?? ??a?=?ones(3,4)?;??b?=?a(4,3)??,?size(b);?
? returns??
a.? 1?
b.? -1?
c.? 1????1?
d.? error?message?
e.? none?of?the?above?
Ans: d
18.?Executing?the?command?iskeyword size returns 0,?i.e.,?size is?not?a?MATLAB?keyword. Given?
this?information,?which?of?the?following?statements?shows?the?result?of?executing?the?following?line?in?the?Command?Window??
? ?size?=?(1:3)’ ?;???size(size)?
a.? wrong?result?(i.e.,?at?least?one?of?the?commands?should?not?be?used?in?MATLAB)?
b.? 1????2?
c.? 2????1?
d.? 2????2?
e.? none?of?above? Ans: a
19.?Executing?in?the?Command?Window?the?following?code
? ??a?=?[1:2]’?;?size(a)?
? returns??
a.? error?message?
b.? 1????2?
c.? 2????1?
d.? 2?
e.? none?of?above?
Ans: c
20.?Executing?in?the?Command?Window?the?following?code?
? ??a?=?1:2?;?size[a]?
? returns??
a.? error?message?
b.? 1????2?
c.? 2????1?
d.? 2?
e.? none?of?above?
21.The?following?lines?show?collections?of?characters?(e.g.,?_xm,?m3)??that?either?can?or?can?not?be?valid?names?of?MATLAB?variables.?Which?line?contains?EXCLUSIVELY?valid?names????
a.?_xm?m3,?abc,?a_B????(wrong,?but?accepted?in?Quiz?1?->?“?_?“?not?allowed?as?1st?char?of?var.?name)?
b.? m3,?3_m,?m_3,?aB??
c.? AA,?for,?a-b,?ab?
d.? AA,?BB,?m3,?a-B?
e.? none?of?above? Ans: a
22.?Which?of?the?following?statements?is?correct??
a.? Function?“clear”?clears?only?the?scalar?variables,?but?does?not?clear?arrays?
b.? Function?“clc”?clears?all?variables?
c.? Function?“clc”?clears?only?constants?
d.? Function?“clear?a”?clears?all?variables?of?the?type?“array”?
e.? None?of?the?above?
Ans: e
?
23.?Executing?in?the?Command?Window?the?following?code?
? A?=?eye(1,10)?;??size(A(2,2))?
? returns??
a.? 1?
b.? 0?
c.? error?message?
d.? 1????1?
e.? none?of?the?above?
Ans: c
24.?Executing?in?the?Command?Window?the?following?code?
? A?=?[1:1:5;;2:1:6]?;??size(A)?
? returns??
a.? 2????5?
b.? 5????2?
c.? error?message?
d.? 3????5?
e.? none?of?the?above? Ans: a
25.?Executing?the?command?iskeyword sin returns 0,?i.e.,?sin?is?not?a?MATLAB?keyword. Given?this?information,?which?of?the?following?statements?shows?the?result?of?executing,?in?the?Command?Window,?of?the?line???
sqrt(sin(-pi/2))??;??sin?=?size(1:5)?
a.? wrong?result?(i.e.,?at?least?one?of?the?commands?should?not?be?used)?
b.? 1?
c.? 1????5?
d.? i?
e.? none?of?above?
Ans: c
26.?Which?of?the?following?statements?is?correct??
a.? Function?“who”?returns?the?name?of?the?currently?logged?user?
b.? Function?“who”?returns?the?name?of?the?system?administrator?
c.? Function?“whos”?displays?the?user?IDs?for?all?accounts?on?the?computer?
d.? Function?“who”?displays?the?web?address?of?the?system?administrator?
e.? None?of?the?above?
Ans: e
27.?After?executing?the?following?script?file?in?MATLAB??
x?=?[2:4?;?-1:1?;?1?2?3];?
y=x(2,:);?
size(y')?
the?displayed?result?is??
a.? 2????2??
b.? 3????1?
c.? 2????1?
d.? 1????3?
e.? none?of?above? Ans: b
28.?After?executing?the?following?script?file?in?MATLAB?
x?=?3i;?
y?=?x/2*sqrt(-1);?
z?=?x?+?y?
the?displayed?result?is?
a.? 1.5?+?3?i?
b.? error?message??
c.? 3?+?1.5?i?
d.? -1.5?+?3?i?
e.? none?of?above?
Ans: d
29.?After?executing?the?following?script?file?in?MATLAB??
x?=?-i;?
y?=?x*sqrt(-1);?
x?+?y?
the?displayed?result?is?
a.? error?message?
b.? -i??
c.? ?i?
d.? 1?-?1?i?
e.? none?of?above??
Ans: d
30.?Executing?in?the?Command?Window?the?following?code?
? ??y?=?a?+?b?,?a?=?2?;?b?=?sqrt(-4)?;?
? returns?
?
a.? 2?+?2?i?
b.? 2?-?2?i?
c.? error?message?
d.? NaN?
e.? none?of?the?above?
Ans: c
31.?Executing?in?the?Command?Window?the?following?code
? ??x = [1:3.4; -6:3.5:0.5] ; size(x)?
? returns??
a.? error?message?
b.? 2?? ?2??
c.? 2?? 3?
d.? 3?? 3?
e.? none?of?the?above? Ans: a
32. To add a comment to the mfile, the MATLAB command is
A ) %
B ) ;
C ) comment(' ')
D ) &
Ans: a
33. When used in the fprintf command, the %g is used as the
A ) single character display
B ) fixed point display
C ) string notation display
D ) default number display
Ans: d
34. When used in the fprintf command, the \n is used to
A ) add a space between any two characters
B ) add a line space (enter key)
C ) place a number into the comment
D ) clear the comment
Ans: b
35. To display 'Question 2' in the command window, the correct command is
A ) disp(Question 2)
B ) display('Question 2')
C ) disp('Question 2')
D ) Question 2
Ans: c
36. The clc command is used to
A ) clear the command window
B ) erase everything in the mfile
C ) clean the desktop
D ) save the existing mfile
Ans: a
37. The num2str command
A ) converts a number to string
B ) converts string to a number
C ) concatenates numbers and strings
D ) concatenates strings
Ans: a
38. The output of the last line is
aa=2
as=num2str(aa)
cat=['cat' as]
A ) cat2
B ) cat 2
C ) ??? Undefined function or variable 'as'
D ) cat aa
Ans: a
39. To join one or more strings into a single string is known as
A ) concatenation
B ) joining
C ) string conversion
D ) string theory
Ans: a
40. The output of
cat=['cat' 'dog']
is
A ) catdog
B ) cat dog
C ) cat&dog
D ) CatDog
Ans: a