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)