20EC0454 - MATLAB Programming
20EC0454 - MATLAB Programming
UNIT - I
INTRODUCTION TO MATLAB
a Define MATLAB and explain its features. [L1][CO1] [6M]
1 Explain how to solve linear algebraic equations by using MATLAB with an
b [L2][CO2] [6M]
example
a What are the good programming practices for MATLAB? [L1][CO1] [6M]
2
b Describe input and output commands used in MATLAB. [L2][CO1] [6M]
What do you understand by debugging and what types of errors occur in
a [L1][CO3] [6M]
MATLAB programming?
Consider the following set of equations and Write MATLAB script to solve it.
3
6x - 4y + 8z = 112
b [L5][CO3] [6M]
-5x - 3y + 7z = 75
-5x - 3y + 7z = 75
What is the purpose of the MATLAB command window, edit window and
a [L1][CO1] [6M]
figure window?
4
List the different ways that you can get help in MATLAB. Write brief notes on
b [L1][CO1] [6M]
MATLAB help system.
a Discuss the functions of Menus and Tool bars available in MATLAB. [L2][CO3] [6M]
5
b List applications, advantages and disadvantages of MATLAB. [L1][CO1] [6M]
How are the elements in the array arranged in the computer’s memory?
a [L2][CO1] [6M]
6
b
Illustrate the MATLAB plotting commands with examples. [L3][CO6] [6M]
a
Discuss MATLAB search Path. [L2][CO1] [6M]
7
b
Explain different MATLAB files for file storage. [L2][CO1] [6M]
a
Differentiate script file and function file. [L4][CO3] [6M]
8
b
Compute volume of sphere of radius 5 cm using a MATLAB script. [L3][CO2] [6M]
a
Compare local variable and global variable in MATLAB. [L4][CO1] [6M]
9
b
How variables are initializing in MATLAB. [L2][CO2] [6M]
a
Calculate first 10 numbers of Fibonacci series and Display on MATLAB. [L3][CO2] [6M]
Examine the following MATLAB statements. Are they correct or incorrect? If
they are correct, what do they output? If they are incorrect, what is wrong with
them?
If volts>125
10 disp(‘WARNING: HIGH votage on line:’);
b [L3][CO4] [6M]
If volts>105
disp(‘WARNING: LOW votage on line:’);
else
disp(‘Line voltage is within tolerances.’)
end
Course Code: 20EC0454 R20
UNIT - II
ARRAYS
What is an array? Write short notes on one dimensional and two-dimensional
a [L1][CO1] [6M]
1 array with an example for each.
b Explain how Array addressing is done in MATLAB with examples. [L2][CO2] [6M]
a What statements are used to control the operation of while loops and for loops? [L1][CO3] [6M]
2
b Describe in brief about multidimensional array with examples. [L2][CO2] [6M]
Write Element-by-Element operation on
a (i) Array Addition and Subtraction [L2][CO2] [6M]
3 (ii) Element-by-Element Multiplication
b What is the purpose of varargin? How does it work. [L2][CO1] [6M]
Write Element-by-Element operation on
a (i) Element-by-Element Division [L1][CO2] [6M]
4
(ii) Element-by-Element Exponentiation
b Explain cell array. How does it differ from ordinary array? [L2][CO1] [6M]
a Explain about polynomial operations using arrays with examples. [L2][CO3] [6M]
5
b Define Empty array with three examples. [L2][CO2] [6M]
Describe about MATLAB array and discuss about the following functions with
6 [L2][CO3] [12M]
examples used in MATLAB program: (i) Zeros ( ). (ii) Ones ( ). (iii) Eye ( ).
Distinguish between array multiplication and matrix multiplication with an
a [L2][CO2] [6M]
example.
7
Which function is used for high level graphical display of the structure of a cell
b [L2][CO5] [6M]
array?
a Construct multidimensional arrays with the help of concatenation function. [L2][CO2] [6M]
A length-n vector can be broken down into sub vector operation of length VL.
8
b How this partitioning can be managed in the case of addition z=x+y where x [L2][CO4] [6M]
and y are vectors. Write an algorithm.
Explain about the functions to sort, rotate, permute, reshape, shift array
9 [L2][CO1] [12M]
contents and circshift array contents.
a What is structure? How does it differ from ordinary arrays and cell arrays? [L2][CO5] [6M]
Given the matrices
21 27 −7 −3
A=[ ] B=[ ]
10 −18 8 9 4
b Find (i) their array product, [L2][CO2] [6M]
(ii) their array right division (A divided by B), and
(iii) ‘B’ raised to the two-power element by element.
Course Code: 20EC0454 R20
UNIT – III
FUNCTIONS AND FILES
a Discuss about elementary mathematical function with appropriate commands. [L2][CO2] [6M]
1
b Explain pre-defined constants with examples. [L2][CO1] [6M]
a What are functions? Explain different types of functions. [L1][CO1] [6M]
2
b Explain in detail about working with data files. [L2][CO1] [6M]
What are the user defined functions? Write MATLAB program to sort vector v
a [L1][CO3] [6M]
= [23 45 12 9 5 0 19 17] using MATLAB commands.
3
b Illustrate how standard menu for a GUI can be created in MATLAB? [L3][CO1] [6M]
Mention the syntax of function statement and create a user defined function to
a [L1][CO2] [6M]
4 return the maximum number when three numbers are given as arguments.
b Explain any 3 complex number handling functions in MATLAB. [L2][CO3] [6M]
a Explain briefly about methods for calling functions. [L2][CO1] [6M]
5 Write MATLAB function to compute function circle which computes the area
b [L2][CO3] [6M]
A and circumference C of a circle, given its radius as an input argument.
Explain different types of user defined functions which are created in
a [L2][CO2] [6M]
6 MATLAB.
b Describe various MATLAB file types. [L2][CO1] [6M]
a Explain Nested function with an example. [L2][CO2] [6M]
7
b Briefly explain importing and exporting excel data files in MATLAB. [L2][CO4] [6M]
a Write short note on minimizing a function of one variable. [L2][CO3] [6M]
Rewrite a program including procedure to evaluate the function f(x,y) for any
two user specified as x & y where f(x,y) is defined as follows:
8 𝑥+𝑦 𝑥 ≥ 0 𝑎𝑛𝑑 𝑦 ≥ 0
b 2 [L2][CO4] [6M]
𝑓(𝑥, 𝑦) = {𝑥 + 𝑦 𝑥 ≥ 0 𝑎𝑛𝑑 𝑦 < 0
2 2
𝑥 + 𝑦 𝑥 < 0 𝑎𝑛𝑑 𝑦 < 0
a Explain the Reduced Row Echelon Form with an example. [L2][CO1] [6M]
3 Find the system of Linear Equations using Cramer’s Rule.
b [L3][CO2] [6M]
2x + y + z = 3, x – y – z = 0, x + 2y + z = 0
a Explain Underdetermined Systems with an example. [L1][CO1] [6M]
4 Solve the following equations, using the matrix inverse method.
b [L2][CO2] [6M]
2x1 + 9x2 =5 3x1 - 4x2 =7
a Describe Matrix functions and commands for solving linear equations. [L2][CO3] [6M]
5 Write MATLAB script using left division method to solve the following set of
b equations. [L2][CO2] [6M]
5x1 - 3x2 = 21 7x1 - 2x2 = 36
Explain Flowchart illustrating a program to solve linear equations with
a [L2][CO3] [6M]
MATLAB code.
Write MATLAB script file to solve following equations.
6
3x1 + 2x2 - 9x3 = - 65
b [L2][CO2] [6M]
-9x1 - 5x2 + 2x3 = 16
6x1 + 7x2 + 3x3 = 5
a Explain how least square method is helpful to solve over determined Systems. [L2][CO1] [6M]
Write MATLAB script to solve following problem in terms of mg.
7
b [L2][CO3] [6M]