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

To Plot Graph of Continuous Time Signals in Matlab

This document contains MATLAB programs and outputs for plotting various continuous and discrete time signals. For continuous signals, it generates plots of the unit step, ramp, parabolic, impulse, rectangular pulse, triangular pulse, signum, sinc, Gaussian, sinusoidal, and real and complex exponential functions. For discrete signals, it produces stem plots of the unit step, ramp, impulse, exponential, sinusoidal, and complex exponential sequences. The document demonstrates various basic signals and their corresponding MATLAB implementations.

Uploaded by

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

To Plot Graph of Continuous Time Signals in Matlab

This document contains MATLAB programs and outputs for plotting various continuous and discrete time signals. For continuous signals, it generates plots of the unit step, ramp, parabolic, impulse, rectangular pulse, triangular pulse, signum, sinc, Gaussian, sinusoidal, and real and complex exponential functions. For discrete signals, it produces stem plots of the unit step, ramp, impulse, exponential, sinusoidal, and complex exponential sequences. The document demonstrates various basic signals and their corresponding MATLAB implementations.

Uploaded by

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

SIGNALS & SYSTEMS (2141005)

Experiment :2
To plot graph of Continuous Time Signals

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 1

SIGNALS & SYSTEMS (2141005)

Unit step function


Program :
T=30;
x=ones(1,T);
t=0:1:T-1
plot(t,x);
grid on;
xlabel('time(sec)')
ylabel('x(t)')

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 2

SIGNALS & SYSTEMS (2141005)

Output :

x(t)

1.5
1

0.5
0
0

10

15

time(sec)

20

Unit ramp function


Program :
t=0:0.03:4;
x=t;
plot(t,x)
grid on;
xlabel('Time(sec)')
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 3

25

30

SIGNALS & SYSTEMS (2141005)

ylabel('x(t)')

Output :

x(t)

3
2
1
0
0

Time(sec)

Unit parabolic function


Program :
t=0:0.01:2;
x=t.^2/2;
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 4

SIGNALS & SYSTEMS (2141005)

plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :

x(t)

1.5
1

0.5
0
0

0.5

Time(sec)

1.5

Impulse function
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 5

SIGNALS & SYSTEMS (2141005)

Program :
for t = 0;
x = 1;
end;
plot(t,x);
stem(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
1
0.8

x(t)

0.6
0.4
0.2
0
-1

-0.5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 6

0.5

SIGNALS & SYSTEMS (2141005)

Rectangular pulse function


Program :
t=-1:0.001:1;
x=rectpuls(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
1
0.8

x(t)

0.6
0.4
0.2
0
-1

-0.5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 7

0.5

SIGNALS & SYSTEMS (2141005)

Triangular pulse function


Program :
t=-1:0.002:1;
x=tripuls(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 8

SIGNALS & SYSTEMS (2141005)

Output:
1
0.8

x(t)

0.6
0.4
0.2
0
-1

-0.5

Time(sec)

0.5

Signum function
Program :
t=-10:0.001:10;
x=sign(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 9

SIGNALS & SYSTEMS (2141005)

Output:

x(t)

0.5

-0.5

-1
-10

-5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

0
Time(sec)

Page 10

10

SIGNALS & SYSTEMS (2141005)

Sinc function
Program :
t =-4:0.05:4;
x=sinc(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output:
1
0.8

x(t)

0.6
0.4
0.2
0
-0.2
-0.4
-4

-2

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 11

SIGNALS & SYSTEMS (2141005)

Gaussian function
Program :
t=-5:0.03:5;
a=1;
x=exp(-a*t.^2);
plot(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 12

SIGNALS & SYSTEMS (2141005)

Output :

1
0.8

x(t)

0.6
0.4
0.2
0
-5

Time(sec)

Sinusoidal signal
Program :
t=0:0.01:2;
x=2*sin(pi*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 13

SIGNALS & SYSTEMS (2141005)

ylabel('x(t)')

Output :
2

x(t)

1
0

-1
-2
0

0.5

Time(sec)

1.5

Real exponential signals


Program :
t=0:0.04:4;
x=2*exp(1*t);
plot(t,x);
grid on;
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 14

SIGNALS & SYSTEMS (2141005)

xlabel('Time(sec)')
ylabel('x(t)')

Output :

1. a>0

60
50

x(t)

40
30
20
10
0
0

Time(sec)

Program :
t=0:0.04:4;
x=2*exp(-1*t);
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 15

SIGNALS & SYSTEMS (2141005)

plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :

2. a<0

1
0.8

x(t)

0.6
0.4
0.2
0
0

Time(sec)

Program :
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 16

SIGNALS & SYSTEMS (2141005)

t=0:0.04:4;
x=2*exp(0*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output : 3. a=0

x(t)

0.5
0

-0.5
-1
0

Time(sec)

Complex exponential function


ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 17

SIGNALS & SYSTEMS (2141005)

Program :
t=-10:0.001:10;
c=complex(0,1);
x=exp(c*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
1

x(t)

0.5
0

-0.5
-1
-10

-5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 18

10

SIGNALS & SYSTEMS (2141005)

Program :
t=-10:0.001:10;
c=complex(-1,12);
x=exp(c*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
3

x 10

x(t)

2
1
0
-1
-2
-10

-5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 19

10

SIGNALS & SYSTEMS (2141005)

Program :
t=-10:0.001:10;
c=complex(1,12);
x=exp(c*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 20

SIGNALS & SYSTEMS (2141005)

Output :

x 10

x(t)

2
1
0
-1
-2
-10

-5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)

Page 21

10

SIGNALS & SYSTEMS (2141005)

Experiment :3
To plot graph of Discrete Time Signals

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 22

SIGNALS & SYSTEMS (2141005)

Unit step sequence


Program :
T=30;
x=ones(1,T);
t=0:1:T-1
stem(t,x);
grid on;
xlabel('time(sec)')
ylabel('x(t)')

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 23

SIGNALS & SYSTEMS (2141005)

Output :

1
0.8

x(t)

0.6
0.4
0.2
0
0

10

15

time(sec)

20

Unit ramp sequence


Program :
t=0:0.5:4;
x=t;
stem(t,x);
grid on;
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 24

25

30

SIGNALS & SYSTEMS (2141005)

xlabel('Time(sec)')
ylabel('x(t)')

Output :
4

x(t)

3
2
1
0
0

Time(sec)

Unit impulse sequence


Program :
for t = 0;
x = 1;
end;
plot(t,x);
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 25

SIGNALS & SYSTEMS (2141005)

stem(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
1
0.8

x(t)

0.6
0.4
0.2
0
-1

-0.5

Time(sec)

0.5

Exponential sequence
Program :
t=0:0.35:4;
x=2.^t;
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 26

SIGNALS & SYSTEMS (2141005)

stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :

50
40

x(t)

30
20
10
0
0

Time(sec)

Program :
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 27

SIGNALS & SYSTEMS (2141005)

t=0:0.35:4;
x=0.2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
1
0.8

x(t)

0.6
0.4
0.2
0
0

Time(sec)

Program :
ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 28

SIGNALS & SYSTEMS (2141005)

t=0:0.35:4;
x=-0.2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :

0
-0.2

x(t)

-0.4
-0.6
-0.8
-1
0

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)

Page 29

SIGNALS & SYSTEMS (2141005)

Program :
t=0:0.35:4;
x=-2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :

x(t)

-5

-10

-15
0

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 30

SIGNALS & SYSTEMS (2141005)

Sinusoidal sequence
Program :
t=0:0.1:2;
x=2*sin(pi*t);
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
2

x(t)

1
0

-1
-2
0

0.5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)
Page 31

1.5

SIGNALS & SYSTEMS (2141005)

Complex exponential sequence


Program :
t=-10:0.3:10;
c=complex(0.3,4);
x=exp(c*t);
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

Output :
20
15

x(t)

10
5
0
-5
-10
-15
-10

-5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)

Page 32

10

SIGNALS & SYSTEMS (2141005)

Program :
t=-10:0.3:10;
c=complex(0.3,4);
x=exp(c*t);
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Page 33

SIGNALS & SYSTEMS (2141005)

Output :

20
15

x(t)

10
5
0
-5
-10
-15
-10

-5

ELECTRICAL DEPARTMENT
BITS EDU CAMPUS

Time(sec)

Page 34

10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy