Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

EEE223 – Signals and Systems

Lab Report # 1
Lab. Experiment Name

Name SYED TAHIR MEHBOOB Reg # FA17-BEE-058

Class & Section BEE-4B Semester SP-19


Performed Date 16 02 2019 Submitted Date 17 02 2019

Task -1: What does the following command do?

>> v(:)
First of all we declare a vector matrix and then after using the command the output is given
below. If we suppose a vector it simply convert rows into coloumn.
>> v=[2 3 3 4]

v=

2 3 3 4

>> v(:)

ans =

2
3
3
4
Converts the rows into single coloumn if we suppose a vector but in case of matrix which is not a vector
so this
This command converts the whole matrix entries into one coloum and rows dependent of size of matrix
by lining up column

1|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

Wise .so this commands convert the whole matrix entries into one colum and rows depend upon the
size of matrix . in case of vector rows into single column

Task(2): Explain the command


linespace?
It generates a row vector between two points in which 100 linearly equally spaced (means that 100
intervals beteen the two points with euqual space)points between the two points the syntax of the
function is

Linspace(2,30)

The result is a row vector between 2 and 30 with the equally spaced gap of 100 means that interval are
100 each one of equal space

>> linspace(2,150)

ans =gb

Columns 1 through 19

2.0000 3.4949 4.9899 6.4848 7.9798 9.4747 10.9697 12.4646 13.9596 15.4545 16.9495
18.4444 19.9394 21.4343 22.9293 24.4242 25.9192 27.4141 28.9091

Columns 20 through 38

30.4040 31.8990 33.3939 34.8889 36.3838 37.8788 39.3737 40.8687 42.3636 43.8586
45.3535 46.8485 48.3434 49.8384 51.3333 52.8283 54.3232 55.8182 57.3131

Columns 39 through 57

58.8081 60.3030 61.7980 63.2929 64.7879 66.2828 67.7778 69.2727 70.7677 72.2626
73.7576 75.2525 76.7475 78.2424 79.7374 81.2323 82.7273 84.2222 85.7172

Columns 58 through 76

2|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

87.2121 88.7071 90.2020 91.6970 93.1919 94.6869 96.1818 97.6768 99.1717 100.6667
102.1616 103.6566 105.1515 106.6465 108.1414 109.6364 111.1313 112.6263 114.1212

Columns 77 through 95

115.6162 117.1111 118.6061 120.1010 121.5960 123.0909 124.5859 126.0808 127.5758 129.0707
130.5657 132.0606 133.5556 135.0505 136.5455 138.0404 139.5354 141.0303 142.5253

Columns 96 through 100

144.0202 145.5152 147.0101 148.5051 150.0000

3|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

Task (3): Explain the output of the following


commands?

>> A = [1 2 3; 4 5 6; 7
8 9]

>> B = A([2 3],[1


2])

>> A = [1 2 3; 4 5 6; 7 8 9]

B = A([2 3],[1 2])

A=

1 2 3

4 5 6

7 8 9

B=

4 5

7 8
The output of the program is that we have a 3*3 matrix stored in A and in B we are storing that go to 2
(Second) row of matrix A and store the entries of first and second entry of row 4 which has column 1
and 2 and also go to 3 (third ) row of matrix A and store the first and secod entries of row 3 (third)

4|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

Task 5: Explain the output of the following


command?

>>
size(A)

It will simply display the size of matrix in short order of matrix that how many rows and how many
coloumn did the matrix have.

For example

>> A = [1 2 3; 4 5 6; 7 8 9]

A=

1 2 3

4 5 6

7 8 9

>> size(A)

ans =

3 3

It shows the size or order of the matrix.

5|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

Task (4): Type the following commands and observe the plot

»t=
-5:.01:5;

» y = sin
(2*pi*t);

» plot
(t,y);

» z = cos
(2*pi*t);

»
plot(t,y,'r',t,z,'k')

The interveel is set on x-axis from -5 t0 +5 with the space between intervals of .01

 Subploting function is used in the program.


 Then we got sine of(t*2*pi)and also cos of(t*2*pi) one is the red one is the sine wave and the
other one is the cos wave/signal but due to the lowest gaps both is looking sinosidal wave one
is starting from 0 and other is starting from 1 .

6|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

Task (7):Explain the following


functions

stem, figure, hold,


subplot.

You may take help from the following


program

>>
figure(1)

>> y = [0 1 2 4 2 1
0];

>>
subplot(2,2,1);

>>
stem(y)

>>
subplot(2,2,2);

>>
plot(y)

>>
figure(2)

>> y = [0 1 2 4 2 1
0];

>>
stem(y)

>> hold
on

7|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

>>
plot(y)

>> hold
off

STEM
Stem command is used where we need discrete plotting for example on evey interval what was the
point or what was the value of y axis wrt x axis that what is the value of y axis at the define intervals of x
axis (data sequence) .so stem command Is used where we want detail or discrete ploting. Or where we
need finite value.

FIGURE
Figure command is used when we are ploting more than one grafh and compiler only plots the last plot
command by replacing the previous plot command so we cannot see the grafh of first plot so figure is
used before the plot command so that compiler know this is figure(1) or show this grafh as figure one
and for nther plot we use figure(2) so that compiler after running show two windows with the two plots
one in figure one and other in figure two.

HOLD

8|Page Department of Electrical & Computer Engineering | CUI Wah


EEE223 – Signals and Systems

Hold command is used where we want in one graph two ploting this is done by command hold when we
use hold on this hold the previous plot or graph and add another plot in the same grafh without
replacing the previous graph

ADVANTAGE IS WE CAN DO STEMMING


SUBPLOT
This command is used where we want the plotting of diferent grafhs in one window this is done by using
subplot command as follow

Subplot(r,c,p)

R is that window rows

C is that window contains how many column

P is the position whre should be the graph placed

9|Page Department of Electrical & Computer Engineering | CUI Wah

You might also like