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

Learning Outcomes:: Birla Institute of Technology & Science, Pilani

This document provides instructions for Lab 1 of the Digital Signal Processing course. The objectives are to learn basic MATLAB commands for generating vectors and matrices, and creating and executing functions for simple programming tasks. The lab contains several exercises: 1) generating array elements by creating, appending, padding, and limiting arrays, 2) understanding random number generation with rand and randn, 3) plotting a simple sine function by generating a sine wave, labeling plots, and adding grids, and 4) creating a function to count multiples of 3 in an array and calling the function from the main script.

Uploaded by

AMAL. A A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Learning Outcomes:: Birla Institute of Technology & Science, Pilani

This document provides instructions for Lab 1 of the Digital Signal Processing course. The objectives are to learn basic MATLAB commands for generating vectors and matrices, and creating and executing functions for simple programming tasks. The lab contains several exercises: 1) generating array elements by creating, appending, padding, and limiting arrays, 2) understanding random number generation with rand and randn, 3) plotting a simple sine function by generating a sine wave, labeling plots, and adding grids, and 4) creating a function to count multiples of 3 in an array and calling the function from the main script.

Uploaded by

AMAL. A A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI

Pilani Campus

EEE F434: Digital Signal Processing


LAB 1: INTRODUCTION TO MATLAB

Learning Outcomes:

At the end of this lab, the student will be able to:

1. Understand the basic commands involved in generating vector and matrices.


2. Create functions and execute them for simple programming tasks.

Note:
1. Lab code files have to be uploaded by 5:50 PM. A unique uploading url for
each lab is shared during the lab hours or directly to your mail. URL
becomes inaccessible after the time period.
2. All the tasks in each lab have to be in one main matlab file with “.m”
extension. However, for function calling, files of the function can be
attached with the main file.
3. Graph plotting should include xlabel, ylabel, legend and titles.
4. When evaluated, all the text results should be printed in the command
window with a statement.
Ex: Find the sum of 1, 2. Answer in command prompt: The total sum: 3.
5. Format of uploading file: “Lab1_2017a3ps0345p.m”.

1) Generating Array elements


a) Create an array of 3 elements having values 100 200 and 300. Name the
array x.
b) Append the same array with 3 other elements all having values 100.
c) Pad the array with 4 zeros.
d) Limit the number of elements in the array to 5 elements.
e) Display the 2nd and the 3rd element of the array at the command prompt.
f) Make a two dimensional array of size 3*3. Call it x3d.
g) Display the 2nd row 3rd column element of the array at the command prompt.
h) Find the transpose of this matrix and display both the 3*3 matrices. Call it
x3dc.

1
i) Find the sum of the array elements in x (the one -dimensional array created in
c).
j) What happens when I use the same command to the 3d array x3d.
k) Make two arrays containing 100 elements from 1 to 100 in steps of 1 and 5,
respectively.
l) Find the lengths of both the recently created arrays.

2) Getting used to rand and randn


a) Obtain 10 random elements using rand and randn functions. Observe the
difference.
b) Use rand function to generate a random sequence and then apply 0.5 as a
threshold to obtain the binary digits. Display the binary digits.
3) Create a simple sine function and Plot it
a) Create a sine wave with duration = 1sec (assume suitable fs) and assign it to a
variable and plot it. Obtain the frequency of the sine wave for this question from
the user.
b) Label your plot and label the axes. Sketch the result obtained on screen here.
c) Obtain grids on your plot.
d) Obtain multiple sine plots of different frequency on the same plot.
e) Obtain these multiple plots on different subplots in the same figure.
4) To Create functions and call and execute them
a) Create a function that counts the number of multiples of 3 in an array. Call it
mult3.
b) Run this function from a main command using some of the test examples.

You might also like