Professional Documents
Culture Documents
Matlab1 PDF
Matlab1 PDF
Lab Journal 1
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