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

Practical2

The document outlines a series of practical MATLAB and Simulink exercises for a student named Praveen Singh Rana, focusing on generating cosine waves, creating various types of matrices, and performing array operations. It includes tasks such as element-wise addition and multiplication of arrays, matrix operations, and user input handling for natural numbers and even/odd checks. Additionally, it involves modeling signal addition and sine wave generation in Simulink.

Uploaded by

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

Practical2

The document outlines a series of practical MATLAB and Simulink exercises for a student named Praveen Singh Rana, focusing on generating cosine waves, creating various types of matrices, and performing array operations. It includes tasks such as element-wise addition and multiplication of arrays, matrix operations, and user input handling for natural numbers and even/odd checks. Additionally, it involves modeling signal addition and sine wave generation in Simulink.

Uploaded by

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

Name :- Praveen Singh Rana

Enrollment no:-23115111

EE-5

Practical -1

Ques.1 Generate and plot a cosine wave as a function of time using


MATLAB code and

Simulink.

Using Matlab
Using Simulink

Ques 2. Write a MATLAB program that demonstrates different ways to


create a 3x3 matrix.

Your program should include the following types of matrices:

(a) A 3x3 matrix with custom values. (c) A 3x3 matrix filled with zeros.

(b) A 3x3 matrix filled with ones. (d) A 3x3 identity matrix.
Ques 3: Write a MATLAB program that performs the following array
operations:

Create two Array A= [ 1, 3, 5, 7, 9] and B= [2, 4, 6, 8, 10]

• Add the two arrays element-wise.

• Subtract the array B from A element wise

Code:-

Output:-
Ques 4. Write a MATLAB program that performs the following array
operations:

Create two Array A= [ 1, 3, 5, 7, 9] and B= [2, 4, 6, 8, 10]

• Multiply the two arrays element-wise.

• Divide array A by array B element wise

Code:-

output:-

Ques 5. Write a code to perform element-wise and matrix multiplication,


compute its

transpose, and find its inverse. Display all results with long format
precision

• A = [2 4 6; 1 3 5; 7 8 9];
Ques.6 Write a MATLAB program to create a 4x4 matrix, extract the
second row and third
column separately, and display them using appropriate indexing
techniques.

Ques 7. Write a program to find the sum of the first N natural numbers.
The value of N should

be provided by the user using for loop.


Ques 8. Write a program to check whether a number entered by the user
is even or odd using

if else command.

Ques 9. Write a MATLAB code using while loop to find the largest digit in a
number provided

by the user.
Ques 10. (a)Model a simple addition of two signals in Simulink.

(b) Create a simple mathematical model of a sine wave generator in


Simulink.

(c) Simulate the response of a step input signal in Simulink.

a)
b)

c)

You might also like