You are on page 1of 5

Signals and Systems Lab

Lab Journal 1

Name: Ayesha Nadeem


Enrollment no: 01-132212-042
Class: BCE-04
Lab instructor: Sir Waqar Tanveer

DEPARTMENT OF COMPUTER ENGINEERING


BAHRIA UNIVERSITY ISLAMBAD
Introduction to MATLAB
Objectives:
 Introduction to signals & systems
 Familiarization with MATLAB interface
 Understanding basic features of MATLAB
 Basic programming techniques
Introduction:
MATLAB is considered as one of the most important tools and modern computer language, and
this course enables us to learn many of MATLAB commands and how to use them in programming
to solve many problems in different mathematical subjects, especially in numerical analysis and
other subjects which connected to computer oriented mathematics.

Software:
 MATLAB

Question 1:

Input:
x=(1:100)
y=(1:-0.1:0)

Output:

Explanation:
Created a vector x containing integer numbers from 1 to 100, then vector y containing numbers 1,
0.9, 0.8, 0.7, . . . 0.1, 0 in order.
Question 2:
Input:
x=(1:100)
y=x(1:25)
z=x(50:75)
w=(0:2:100)

Output:

Explanation:
Created y containing first 25 elements of x, z containing elements of x with indexes from 50 to 75
and w containing elements with even indexes

Question 3:
Input:
x=[1,1,1;1,1,1;1,1,1]
x=[0;0;0;0;0;0;0;0]
x=[0.37,0.37;0.37,0.37;0.37,0.37;0.37,0.37;0.37,0.37]

Output:

Explanation:
Created matrix 3 by 3 with all ones, then created matrix 8 by 1 with all zeros and at the end created
matrix 5 by 2 with all elements equal to 0.37.

Question 4:
Input:
r = -0.5 + (0.5+0.5)*rand(1,25)

Output:
Explanation:
Created vector 1 by 25 containing random elements uniformly distributed in the interval [−0.5,
0.5]. and N random numbers in the interval (a,b) with the formula r = a + (b-a).*rand(N,1).

Question 5:
Input:
x = [3, 1, 2, 5, 4]
y = fliplr(x)
ind = find(x > 2)
z = x(x < 4)

Output:

Explanation:
Created a vector x, from x created y in the reverse order and then found the indices find indices of those
elements that are greater than 2 and at last created z containing elements of x which are smaller than 4.

Conclusions:
In this lab we have learned the Introduction to signals & systems, understanding basic features of
MATLAB and basic programming techniques

You might also like