MATLAB and R Programming (ME-705) - Important Questions
-
Unit 110 Marks High Priority
Write an M-file that reads an $n \times n$ matrix, extracts its main diagonal and returns the sum of diagonal elements (handle complex entries).
Core programming task: direct extraction and summation of main diagonal (handles complex entries). High-priority practical M-file question frequently asked in exams.
-
Unit 17 Marks High Priority
Write an M-file that takes a character vector (string) of ASCII characters, converts each character to its ASCII code, shifts each code by 3 (Caesar cipher), handles wrap-around for letters, and returns the encoded string.
M-file string and ASCII manipulation: tests understanding of character encoding and simple algorithm implementation in MATLAB.
-
Unit 110 Marks High Priority
Using MATLAB, demonstrate creation of matrices using the colon operator, linspace, zeros, ones, and eye. Perform matrix addition, element-wise multiplication, matrix multiplication, compute inverse and determinant for a square matrix, and explain the difference between element-wise and matrix operations. Provide short code examples for each operation.
Fundamental matrix creation and arithmetic operations: covers creation functions and both element-wise and matrix-level operations — core Unit 1 topic.
-
Unit 17 Marks High Priority
In MATLAB, plot the parametric curve $x=\cos(t)$, $y=\sin(2t)$ for $t\in\left[0,2\pi\right]$. Label the axes, add a title and legend, and set an appropriate line style and marker.
Standard plotting question: parametric plotting with labels, legend and styling — commonly asked practical exercise.
-
Unit 110 Marks High Priority
In MATLAB, generate a random complex vector $z$ of length 100, compute the sum $\sum z$, compute the mean and standard deviation of real and imaginary parts, and plot $\operatorname{real}(z)$ versus $\operatorname{imag}(z)$. Provide the script and explain each step.
Complex number handling and basic statistics: random complex vector generation, summation and plotting real vs imaginary parts — encapsulates several frequent subtopics.
-
Unit 17 Marks High Priority
Explain the basic MATLAB environment and commonly used commands: help, doc, who, whos, clear, clc, and workspace operations. Demonstrate with a short script that creates variables, lists them, clears one variable, and saves the workspace to a .mat file.
Introductory environment and commands: assesses familiarity with the MATLAB interface and basic workspace commands.
-
Unit 17 Marks High Priority
Explain differences between MATLAB matrices and R data frames. Provide short examples in MATLAB and in R showing the creation of a numeric matrix in MATLAB and an equivalent data frame in R, and state scenarios where each structure is preferable.
Comparative conceptual question between MATLAB and R data structures — tests conceptual understanding and ability to show short code examples.
-
Unit 17 Marks High Priority
Using R, create a data frame with one numeric column and one factor column. Show R code to append a new row and subset the data frame to include only rows where the factor has a specified level. Explain issues that may arise with factor levels when appending rows.
R data frame manipulation: practical R task on creating, appending and subsetting data frames — frequently examined practical skill.
-
Unit 110 Marks High Priority
Write a MATLAB script to generate a 3-D surface plot of $z=\sin\left(\sqrt{x^2 + y^2}\right)$ over $x,y\in\left[-6,6\right]$ using meshgrid and surf. Include axis labels and a colorbar.
Advanced plotting: 3-D surface plotting using meshgrid and surf — tests both plotting and array-generation skills.
Quick Add to Notes
Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.
Create free accountHave an account? Log in
Notes Panel