20ec0454 Matlab Programming Question Bank
20ec0454 Matlab Programming Question Bank
10 a What is structure array? How does it differ from ordinary arrays and cell arrays? [L1][CO2] [6M]
b Create a structure array to contain the following types of student data: [L3][CO1] [6M]
■ Student name.
■ Social Security number.
■ Email address.
■ Test scores.
Enter the data shown in Figure
UNIT-III
FUNCTIONS AND FILES
1 a Discuss about Exponential and Logarithmic Functions in elementary mathematical [L2][CO3] [6M]
function with appropriate commands.
b Compute the following using MATLAB commands. [L1][CO1] [6M]
a) √−144
b) 𝑒 3𝑦
c) log10(2y)
d) log (-4x)
2 a Explain how complex functions are handled by MATLAB. Give some examples. [L2][CO4] [6M]
b Explain the following MATLAB commands with suitable examples. [L5][CO3] [6M]
a) The round function,
b) The ceil function,
c) The floor function.
3 a Explain how Trigonometric Functions and Hyperbolic Functions are handled by [L2][CO2] [6M]
MATLAB. Give some examples.
b Compute the following using MATLAB. [L1][CO4] [6M]
a) For several values of x in the range 0 ≤ x ≤ 2, confirm that
tan (2 x) = 2 tan x/ (1-tan2 x).
R20 20EC0454-MATLAB PROGRAMMING
b) For several values of x in the range 0 ≤ x ≤ 5, confirm that sin(ix)= i sinh x.
4 a What is User-Defined Functions? Give Some Simple Function Examples [L2][CO1] [6M]
b Write short note on minimizing a function of one variable. [L1][CO2] [6M]
5 a Compute the area A and circumference C of a circle, given its radius(r=4) as an [L2][CO4] [8M]
input argument.
b What are the advantages of User-Defined Functions in MATLAB? [L1][CO2] [4M]
6 a Distinguish between Local Variables and Global Variables. [L2][CO3] [6M]
b Explain about methods for calling functions. [L5][CO2] [6M]
7 What is mean by functions? Explain various types functions in MATLAB with [L1][CO1] [12M]
suitable example.
8 a Explain about Anonymous Functions with suitable example. [L2][CO3] [6M]
b How Multiple-Input Arguments are handled in Anonymous Functions [L1][CO2] [6M]
9 a What are Nested Functions? Explain with suitable example. [L3][CO2] [6M]
b Explain about Private function with suitable example. [L2][CO5] [6M]
10 a Briefly explain importing wizard and excel data files in MATLAB. [L5][CO5] [6M]
b How to Export ASCII Data Files in MATLAB? [L4][CO3] [6M]
UNIT – IV
PROGRAMMING TECHNIQUES AND PLOTTING
1 a How program is designed and developed in MATLAB? [L3][CO1] [6M]
b Compute the perimeter p and the area A of a triangle whose sides are a, b, and c. [L2][CO4] [6M]
The formulas are p=a+b+c, s= (P/2), A=√𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠 − 𝑐),with suitable
steps.
2 a Explain about Conditional Operations with suitable example. [L2][CO5] [6M]
b Explain about Iterative Operations with suitable example. [L5][CO3] [6M]
3 a List various relational operators available in MATLAB with detailed [L1][CO1] [6M]
description.
b How Logical Operators and Functions are handled in MATLAB? [L3][CO2] [6M]
4 a If x = [5, -3, 18, 4] and y = [-9, 13, 7, 4], what will be the result of the following [L1][CO1] [6M]
operations? Use MATLAB to check your answer.
a) z = ~y > x
b) z = x & y
c) z = x | y
d) z = xor (x,y)
b Suppose that x = [-9, -6, 0, 2, 5] and y = [-10, -6 2, 4,6]. What is the result of the [L3][CO4] [6M]
following operations? Determine the answers by hand, and then use MATLAB to
check your answers.
a) z = (x < y)
b) z = (x > y)
c) z = (x ~= y)
d) z = (x == y)
e) z = (x > 2)
5 a Explain “ if ” Statement in MATLAB With suitable flow chart. [L5][CO1] [6M]
b Write the following statements to use only one if statement using MATLAB [L3][CO4] [6M]
a) if x < y then, w = xy.
R20 20EC0454-MATLAB PROGRAMMING
-1
b) if a = b then, u= sinh (ab).
6 a Explain “ else ” and “elseif” Statement in MATLAB With suitable flow chart. [L2][CO1] [6M]
b Write a program that accepts a numerical value x from 0 to 100 as input and [L1][CO4] [6M]
computes and displays the corresponding letter grade given by the following table.
a) x ≥90
b) 80 ≤ x ≤ 89
c) 70 ≤ x ≤ 79
d) 60 ≤ x ≤ 69
e) x < 60
a. Use nested if statements in your program (do not use elseif).
b. Use only elseif clauses in your program.
7 a Explain “for loop” Statement in MATLAB With suitable example. [L5][CO3] [6M]
b Write a script file to compute the sum of the first 15 terms in the series 5 k2 -2k, [L2][CO1] [6M]
k=1, 2, 3, . . . , 15.
8 a Write a program using the switch structure to input one angle, whose value may be [L3][CO2] [6M]
45, -45, 135, or -1350, and display the quadrant (1, 2, 3, or 4) containing the angle.
b Explain “ xy Plotting Functions” in MATLAB. [L2][CO1] [6M]
9 a What are the tools available in Interactive Plotting in MATLAB? Give suitable [L1][CO2] [6M]
Example.
b Explain plot commands [L2[CO4] [6M]
a) plot (x,y),
b) title ( )
c) xlabel ( )
d) ylabel ( )
in MATLAB with an example.
10 a Plot the equation y= 0.4 √1.8 𝑥 for 0 ≤ x ≤ 35 and 0 ≤ y ≤ 3.5. [L1][CO5] [6M]
b How to plot Three-Dimensional functions in MATLAB with suitable example. [L2][CO2] [6M]
UNIT – V
LINEAR ALGEBRAIC EQUATIONS
1 a Explain matrix methods for linear equations with example. [L2][CO2] [6M]
b Solve the following equations, using the matrix inverse method. [L3][CO1] [6M]
2x1 + 9x2 =5
3x1 - 4x2 =7
2 a Define Rank of Matrix with suitable example. [L1][CO1] [6M]
b For what values of C will the following set [L2][CO4] [6M]
(a) have a unique solution and
(b) Have an infinite number of solutions?
Find the relation between x1 and x2 for these solutions.
6 x1 + C x2 = 0
2 x1 + 4 x2 = 0
3 a Write MATLAB script using left division method to solve the following set of [L1][CO4] [6M]
equations.
5 x1 - 3 x2 = 21
7 x1 - 2 x2 = 36
R20 20EC0454-MATLAB PROGRAMMING
b For what cases left division method gives error? Explain.
4 a Explain the Reduced Row Echelon Form with an example. [L2][CO3] [6M]
b The following underdetermined equation has an infinite number of solutions exist. [L3][CO4] [6M]
Use the “ rref “ function to obtain the solutions.
2 x1 - 4 x2 + 5 x3 = -4
-4 x1 - 2 x2 + 3 x3 = 4
2 x1 + 6 x2 - 8 x3 = 0
5 a Explain how Cramer’s Rule performed in MATLAB? with an example. [L5][CO1] [6M]
b Find the system of Linear Equations using Cramer’s Rule. [L1][CO6] [6M]
2x + y + z = 3
x–y–z=0
x + 2y + z = 0
6 a Explain Underdetermined Systems with an example. [L5][CO4] [6M]
b The following table shows how many hours reactors A and B need to produce 1 [L4][CO1] [6M]
ton each of the chemical products 1, 2, and 3. The two reactors are available for
40 and 30 hr per week, respectively. Determine how many tons of each product
can be produced each week.
Hours Product 1 Product 2 Product 3
Reactor A 5 3 3
Reactor B 3 3 4
7 a Explain Overdetermined Systems with an example. [L2][CO1] [6M]
b Solve the following equations and discuss the solution for two cases: [L3][CO3] [6M]
c = 9 and c =10.
x1 + x2 = 1
x1 + 2 x2 = 3
x1 + 5 x2 = c
8 a Explain how least square method is helpful to solve over determined Systems. [L2][CO1] [6M]
b Solve the following equations, using the matrix inverse method. [L1][CO3] [6M]
3x1 - 4x2 = 5
6x1 + 8x2 = 2
9 a Discuss in brief about: a) Under determined system b) over determined system. [L2][CO4] [6M]
b List the different methods of transfer functions in MATLAB with examples. [L1][CO1] [6M]
10 a a) Use MATLAB to solve the following equations for x, y, and z as [L4][CO3] [6M]
x - 5y - 2z = 11c
6x + 3y + z = 13c
7x + 3y - 5z = 10c
b) Plot the solutions for x, y, and z versus c on the same plot, for -10 ≤ c ≤10.
b Discuss about computational difficulties using theoretical linear algebra [L2][CO5] [6M]
techniques.