MATLAB Programming - BEC358B - Important Questions - Module Wise - 1
MATLAB Programming - BEC358B - Important Questions - Module Wise - 1
1. Explain the steps involved in making a 2 – D plot in MATLAB and print it out.
2. Write a MATLAB program to plot y = sin ( x), 0 x 2 taking 100 linearly spaced points
in the given interval. Label the axes and put "Plot created by your name" in the title.
3. Write a MATLAB program to plot y = e −0.4 x sin ( x), 0 x 4 taking 10, 50, and 100
points in the interval.
4. Explain the steps involved in creating script files and executing them in MATLAB.
5. Write a MATLAB script file that, when executed, greets you, displays the date and time,
and curses your favourite TA or professor.
6. Explain with an example, how to write and execute a function file.
7. Write a function factorial to compute the factorial n! for any integer n in MATLAB. The
input should be the number n and the output should be n!
8. Write a function to compute the sum of a geometric series 1 + r + r 2 + r 3 + + r n for a
given r and n. Thus, the input to the function must be r and n and the output must be the
sum of the series.
2 6 1 2 −5 5
9. Let A = B= C= Check some linear algebra rule:
3 9 3 4 5 3
• Is matrix addition commutative? Compute A+B and then B+A. Are the results the
same?
• Is matrix addition associative? Compute (A+B)+C and then A+(B+C) in the order
prescribed. Are the results the same?
• Is multiplication with a scalar distributive? Compute α(A+B) and αA+ αB, taking
α = 5, and show the results are the same.
• Is multiplication with a matrix distributive? Compute A*(B+C) and compare with
A*B+A*C.
J N N COLLEGE OF ENGINEERING, SHIVAMOGGA – 577204
6. Write a MATLAB program, to solve two simultaneous algebraic equations for x and y:
ax − by + 3 = 0 − − − −(1)
− x + 2ay − 5 = 0 − − − −(2)
Then, substitute the values of x and y just found in expression 1 to check the result and
simplify the answer to see, if it reduces to zero.
7. Explain the three different kinds of files for reading data into MATLAB’s workspace.
8. Write a note on how to navigate through MATLAB directory system and work with files
in a particular location.
J N N COLLEGE OF ENGINEERING, SHIVAMOGGA – 577204