0% found this document useful (0 votes)
5 views

MATLAB Course Assignment (1)

Matlab questions

Uploaded by

Ishant
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

MATLAB Course Assignment (1)

Matlab questions

Uploaded by

Ishant
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MATLAB Course Assignment - Module 1: Introduction to Programming Basics

Instructions:

• Complete the following questions and exercises.

• Submit your MATLAB scripts and a brief report explaining your solutions.

• Make sure to comment your code for clarity.

Submission Deadlines:9th September 2024 Mode of Submission: Online

Part 1: Theoretical Questions

1. Introduction to MATLAB:

o What is MATLAB, and why is it widely used in engineering, science, and


mathematics?

o Explain the difference between a scalar, a vector, and a matrix in MATLAB


with examples.

2. Key Terminologies:

o Define the following terms in the context of MATLAB:

▪ Variable

▪ Array

▪ Function

▪ Script

▪ Matrix

3. Operators in MATLAB:

o Describe the difference between element-wise operations and matrix


operations in MATLAB. Provide examples to illustrate the difference.

4. Debugging:

o What is debugging in MATLAB, and why is it important? Describe a situation


where you might need to use debugging techniques.
Part 2: MATLAB Exercises

1. Basic Operations:

o Write a MATLAB script that:

1. Accepts two numbers as input from the user.

2. Performs the following operations: addition, subtraction,


multiplication, division, and exponentiation.

3. Displays the results in a clear and formatted manner.

2. Working with Arrays and Matrices:

o Create the following in MATLAB:

1. A row vector with elements [1, 2, 3, 4, 5].

2. A column vector with elements [1; 2; 3; 4; 5].

3. A 3x3 matrix with random numbers.

4. Multiply the row vector by the column vector and display the result.

5. Extract the second row of the 3x3 matrix and display it.

3. Functions:

o Write a MATLAB function named calculateArea that:

1. Accepts the radius of a circle as an input.

2. Returns the area of the circle.

3. In the main script, prompt the user to input the radius and display the
calculated area using the function.

4. Matrix Operations:

o Given two matrices A = [1, 2; 3, 4] and B = [5, 6; 7, 8], perform the following:

1. Matrix addition

2. Matrix multiplication

3. Element-wise multiplication

4. Calculate the determinant of matrix A


5. Find the eigenvalues and eigenvectors of matrix A

5. Vector Calculus (Advanced):

Create three row vectors

A=[7 2 -3 1 0], B=[-3 10 0 7 -2], c=[1 0 4 -6 5]

(a). Use the three vector in a MATLAB command to create a 3×5 matrix such that the
first, second, and third rows consist of the first three elements of the vector a, b and
c respective

6. Draw a Circle

Write a MATLAB script that draws a circle with a given radius. The user should be
prompted to input the radius of the circle and the coordinates of its center. Your
script should:

1. Use the parametric equations

to calculate the points on the circle.

2. Plot the circle on a graph with a grid, labeled axes, and a title that includes
the radius of the circle.

3. Ensure that the aspect ratio of the plot is set to equal, so the circle is not
distorted.

Bonus: Allow the user to draw multiple circles by repeating the input process until
they choose to exit.

You might also like