0% found this document useful (0 votes)
77 views19 pages

Lab No 06

The document describes experiments conducted using MATLAB to plot various continuous and discrete time signals of the form x(t) = Ce^βt and x(n) = Ce^βn. For each signal, the plots are generated by varying the values of C and β and observing their effects on the shape of the signal graphs. Specifically, negative β values result in decaying exponential curves while positive β values produce rising exponentials. The amplitude is affected by the value of C. Similar observations are made for complex exponential signals of the form x(t) = Ce^(jβt) and x(n) = Ce^(jβn). Additional experiments introduce a real component γ to the exponential term.

Uploaded by

Zarafsha Abbas
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)
77 views19 pages

Lab No 06

The document describes experiments conducted using MATLAB to plot various continuous and discrete time signals of the form x(t) = Ce^βt and x(n) = Ce^βn. For each signal, the plots are generated by varying the values of C and β and observing their effects on the shape of the signal graphs. Specifically, negative β values result in decaying exponential curves while positive β values produce rising exponentials. The amplitude is affected by the value of C. Similar observations are made for complex exponential signals of the form x(t) = Ce^(jβt) and x(n) = Ce^(jβn). Additional experiments introduce a real component γ to the exponential term.

Uploaded by

Zarafsha Abbas
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/ 19

LAB NO # 06

Signal Characteristics and Transformations Using MATLAB

Task : 01

Consider the continuous time signal x(t) = Ceβt, 0 ≤ t ≤ 14. Plot this signal
with step size of 0.01 for the following values of C and β. (Paste single Output
figure use subplot command with proper title,xlabel,ylabel.Use the command
“suptitle” for whole figure title).
C = 1, β = 1
C = 0.5, β = 1
C = 2, β = 1
C = 1, β = 0.5
C = 1, β = 2
C = 1, β = -1
C = 0.5, β = -1
C = 2, β = -1
C = 1, β = -0.5
C = 1, β = -2
Write down your observations about the results?

CODE:

%%18-EE-36
%%task 01
t=0:0.01:14;
x1=exp(1*t);
subplot(5,2,1);
plot(t,x1);
xlabel('Time');
ylabel('X(t)');
title('1*exp(t)');
x2=0.5*exp(1*t);
subplot(5,2,2);
plot(t,x2);
xlabel('Time');
ylabel('X(t)');
title('0.5*exp(t)')
x3=2*exp(1*t);
subplot(5,2,3);
plot(t,x3);

1
xlabel('Time');
ylabel('X(t)');
title('2*exp(t)');
x4=1*exp(0.5*t);
subplot(5,2,4);
plot(t,x4);
xlabel('Time');
ylabel('X(t)');
title('1*exp(0.5*t)');
x5=1*exp(2*t);
subplot(5,2,5);
plot(t,x5);
xlabel('Time');
ylabel('X(t)');
title('1*exp(2*t)');
x6=1*exp(-1*t);
subplot(5,2,6);
plot(t,x6);
xlabel('Time');
ylabel('X(t)');
title('1*exp(-1*t)');
x7=0.5*exp(-1*t);
subplot(5,2,7);
plot(t,x7);
xlabel('Time');
ylabel('X(t)');
title('0.5*exp(-1*t)');
x8=2*exp(-1*t);
subplot(5,2,8);
plot(t,x8);
xlabel('Time');
ylabel('X(t)');
title('2*exp(-1*t)');
x9=1*exp(-0.5*t);
subplot(5,2,9);
plot(t,x9);
xlabel('Time');
ylabel('X(t)');
title('1*exp(-0.5*t)');
x10=1*exp(-2*t);
subplot(5,2,10);
plot(t,x10);
xlabel('Time');
ylabel('X(t)');
title('1*exp(-2*t)');

2
OUTPUT:

FIGURE

Observation:
If β is negative then the exponential curve decays gradually and if it is positive then the
graph will be rising exponential. On the other hand,when we change C then the amplitude
gets effected.
Task : 02

Consider the discrete time signal x(n) = Ceβn, 0 ≤ n ≤ 14. Plot this signal for
the following values of C and β. (Paste single Output figure use subplot
command with proper title,xlabel,ylabel.Use the command “suptitle” for
whole figure title)
C = 1, β = 1
C = 0.5, β = 1
C = 2, β = 1
C = 1, β = 0.5
C = 1, β = 2
C = 1, β = -1
C = 0.5, β = -1
C = 2, β = -1
C = 1, β = -0.5
C = 1, β = -2
Writedown your observations about the results?

3
CODE:

%%18-EE-36
%%task 02
n=0:14;
x1=exp(1*n);
subplot(5,2,1); stem(n,x1);
xlabel('Time'); ylabel('X(n)');
title('1*exp(n)');
x2=0.5*exp(1*n);
subplot(5,2,2); stem(n,x2);
xlabel('Time'); ylabel('X(n)');
title('0.5*exp(n)')
x3=2*exp(1*n);
subplot(5,2,3); stem(n,x3);
xlabel('Time'); ylabel('X(n)');
title('2*exp(n)');
x4=1*exp(0.5*n);
subplot(5,2,4); stem(n,x4);
xlabel('Time'); ylabel('X(n)');
title('1*exp(0.5*n)');
x5=1*exp(2*n);
subplot(5,2,5); stem(n,x5);
xlabel('Time'); ylabel('X(n)');
title('1*exp(2*n)');
x6=1*exp(-1*n);
subplot(5,2,6); stem(n,x6);
xlabel('Time'); ylabel('X(n)');
title('1*exp(-1*n)');
x7=0.5*exp(-1*n);
subplot(5,2,7); stem(n,x7);
xlabel('Time'); ylabel('X(n)');
title('0.5*exp(-1*n)');
x8=2*exp(-1*n);
subplot(5,2,8); stem(n,x8);
xlabel('Time'); ylabel('X(n)');
title('2*exp(-1*n)');
x9=1*exp(-0.5*n);
subplot(5,2,9); stem(n,x9);
xlabel('Time'); ylabel('X(n)');
title('1*exp(-0.5*n)');
x10=1*exp(-2*n);
subplot(5,2,10); stem(n,x10);
xlabel('Time'); ylabel('X(n)');
title('1*exp(-2*n)');

4
OUTPUT:

FIGURE

Task : 02

Observation:
If β is negative then the exponential curve decays gradually and if it is positive then the
graph will be rising exponential. On the other hand,when we change C then the amplitude
gets effected.
Task : 03

Consider the continuous time signal x(t) = Cejβt, 0 ≤ t ≤ 14. Plot this signal
with step size of 0.01 for the following values of C and β. (Paste single Output
figure use subplot command with proper title,xlabel,ylabel.Use the command
“suptitle” for whole figure title).
C = 1, β = 1
C = 0.5, β = 1
C = 2, β = 1
C = 1, β = 0.5
C = 1, β = 2
C = 1, β = -1
C = 0.5, β = -1
C = 2, β = -1
C = 1, β = -0.5
C = 1, β = -2

5
CODE:

%%task 3
t=0:0.01:14;
x1=exp(1*i*t);
subplot(5,2,1); plot(t,x1);
xlabel('Time'); ylabel('X(t)');
title('1*exp(it)');
x2=0.5*exp(1*i*t);
subplot(5,2,2); plot(t,x2);
xlabel('Time'); ylabel('X(t)');
title('0.5*exp(it)')
x3=2*exp(1*i*t);
subplot(5,2,3); plot(t,x3);
xlabel('Time'); ylabel('X(t)');
title('2*exp(it)');
x4=1*exp(0.5*i*t);
subplot(5,2,4); plot(t,x4);
xlabel('Time'); ylabel('X(t)');
title('1*exp(0.5it)');
x5=1*exp(2*i*t);
subplot(5,2,5); plot(t,x5);
xlabel('Time'); ylabel('X(t)');
title('2*exp(0.5it)');
x6=1*exp(-1*i*t);
subplot(5,2,6); plot(t,x5);
xlabel('Time'); ylabel('X(t)');
title('1*exp(-it)');
x7=0.5*exp(-1*i*t);
subplot(5,2,7); plot(t,x7);
xlabel('Time'); ylabel('X(t)');
title('0.5*exp(-1it)');
x8=2*exp(-1*i*t);
subplot(5,2,8); plot(t,x8);
xlabel('Time'); ylabel('X(t)');
title('2*exp(-it)');
x9=1*exp(-0.5*i*t);
subplot(5,2,9); plot(t,x9);
xlabel('Time'); ylabel('X(t)');
title('1*exp(-0.5it)');
x10=1*exp(-2*i*t);
subplot(5,2,10); plot(t,x10);
xlabel('Time'); ylabel('X(t)');
title('1*exp(-2it)');

6
OUTPUT:

FIGURE

Task : 02

Task : 04

Consider the discrete time signal x(n) = Cejβn, 0 ≤ n ≤ 14. Plot this signal for
the following values of C and β. (Paste single Output figure use subplot
command with proper title,xlabel,ylabel.Use the command “suptitle” for
whole figure title)
C = 1, β = 1
C = 0.5, β = 1
C = 2, β = 1
C = 1, β = 0.5
C = 1, β = 2
C = 1, β = -1
C = 0.5, β = -1
C = 2, β = -1
C = 1, β = -0.5
C = 1, β = -2
Writedown your observations about the results?

7
CODE:

%%task 4
n=0:14;
x1=exp(1*i*n);
subplot(5,2,1); stem(n,x1);
xlabel('Time'); ylabel('X(n)');
title('1*exp(in)');
x2=0.5*exp(1*i*n);
subplot(5,2,2); stem(n,x2);
xlabel('Time'); ylabel('X(n)');
title('0.5*exp(in)')
x3=2*exp(1*i*n);
subplot(5,2,3); stem(n,x3);
xlabel('Time'); ylabel('X(n)');
title('2*exp(in)');
x4=1*exp(0.5*i*n);
subplot(5,2,4); stem(n,x4);
xlabel('Time'); ylabel('X(n)');
title('1*exp(0.5in)');
x5=1*exp(2*i*n);
subplot(5,2,5); stem(n,x5);
xlabel('Time'); ylabel('X(n)');
title('2*exp(0.5in)');
x6=1*exp(-1*i*n);
subplot(5,2,6); stem(n,x5);
xlabel('Time'); ylabel('X(n)');
title('1*exp(-in)');
x7=0.5*exp(-1*i*n);
subplot(5,2,7); stem(n,x7);
xlabel('Time'); ylabel('X(n)');
title('0.5*exp(-1in)');
x8=2*exp(-1*i*n);
subplot(5,2,8); stem(n,x8);
xlabel('Time'); ylabel('X(n)');
title('2*exp(-in)');
x9=1*exp(-0.5*i*n);
subplot(5,2,9); stem(n,x9);
xlabel('Time'); ylabel('X(n)');
title('1*exp(-0.5in)');
x10=1*exp(-2*i*n);
subplot(5,2,10); stem(n,x10);
xlabel('Time'); ylabel('X(n)');
title('1*exp(-2in)');

8
OUTPUT:

FIGURE

Task : 02

Task : 05

Consider the continuous time signal x(t) = Ce (γ + jβ)t, 0 ≤ t ≤ 20. Plot this signal
with step size of 0.01 for the following values of C and β. (Take γ =
0.2).(Paste single Output figure use subplot command with proper
title,xlabel,ylabel.Use the command “suptitle” for whole figure title).
C = 1, β = 1
C = 0.5, β = 1
C = 2, β = 1
C = 1, β = 0.5
C = 1, β = 2
C = 1, β = -1
C = 0.5, β = -1
C = 2, β = -1
C = 1, β = -0.5
C = 1, β = -2
Writedown your observations about the results?

9
CODE:

%%task 5
t=0:0.01:20;
y=0.2;
x1=1*exp((y+i*1)*t);
subplot(2,5,1); plot(t,x1);
xlabel('Time'); ylabel('x(t)');
title('1*exp((y+i*1)*t)');
x2=0.5*exp((y+i*1)*t);
subplot(2,5,2); plot(t,x2);
xlabel('Time'); ylabel('x(t)');
title('0.5*exp((y+i*1)*t');
x3=02*exp((y+i*1)*t);
subplot(2,5,3); plot(t,x3);
xlabel('Time'); ylabel('x(t)');
title('02*exp((y+i*1)*t)');
x4=1*exp((y+i*0.5)*t);
subplot(2,5,4); nplot(t,x4);
xlabel('Time'); ylabel('x(t)');
title('1*exp((y+i*0.5)*t');
x5=1*exp((y+i*2)*t);
subplot(2,5,5); plot(t,x5);
xlabel('Time'); ylabel('x(t)');
title('1*exp((y+i*2)*t)');
x6=1*exp((y+i*-1)*t);
subplot(2,5,6); plot(t,x6);
xlabel('Time'); ylabel('x(t)');
title('1*exp((y+i*-1)*t)');
x7=0.5*exp((y+i*-1)*t);
subplot(2,5,7); plot(t,x7);
xlabel('Time'); ylabel('x(t)');
title('0.5*exp((y+i*-1)*t)');
x8=2*exp((y+i*-1)*t);
subplot(2,5,8); plot(t,x8);
xlabel('Time'); ylabel('x(t)');
title('2*exp((y+i*-1)*t)');
x9=1*exp((y+i*-0.5)*t);
subplot(2,5,9); plot(t,x9);
xlabel('Time'); ylabel('x(t)');
title('1*exp((y+i*-0.5)*t');
x10=1*exp((y+i*-2)*t);
subplot(2,5,10); plot(t,x10);
xlabel('Time'); ylabel('x(t)');
title('1*exp((y+i*-2)*t)');
10
OUTPUT:

FIGURE

Task : 02

Task : 06

Consider the discrete time signal x(n) = Ce (γ + jβ)n, 0 ≤ n ≤ 20. Plot this signal
for the following values of C and β. (Take γ = 0.2).(Paste single Output figure
use subplot command with proper title,xlabel,ylabel.Use the command
“suptitle” for whole figure title).
C = 1, β = 1
C = 0.5, β = 1
C = 2, β = 1
C = 1, β = 0.5
C = 1, β = 2
C = 1, β = -1
C = 0.5, β = -1
C = 2, β = -1
C = 1, β = -0.5
C = 1, β = -2
Writedown your observations about the results?

11
CODE:

%%task 6
n=0:20;
y=0.2;
x1=1*exp((y+i*1)*n);
subplot(2,5,1); stem(n,x1);
xlabel('Time'); ylabel('x(n)');
title('1*exp((y+i*1)*n)');
x2=0.5*exp((y+i*1)*n);
subplot(2,5,2); stem(n,x2);
xlabel('Time'); ylabel('x(n)');
title('0.5*exp((y+i*1)*n');
x3=02*exp((y+i*1)*n);
subplot(2,5,3); stem(n,x3);
xlabel('Time'); ylabel('x(n)');
title('02*exp((y+i*1)*n)');
x4=1*exp((y+i*0.5)*n);
subplot(2,5,4); stem(n,x4);
xlabel('Time'); ylabel('x(n)');
title('1*exp((y+i*0.5)*n');
x5=1*exp((y+i*2)*n);
subplot(2,5,5); stem(n,x5);
xlabel('Time'); ylabel('x(n)');
title('1*exp((y+i*2)*n)');
x6=1*exp((y+i*-1)*n);
subplot(2,5,6); stem(n,x6);
xlabel('Time'); ylabel('x(n)');
title('1*exp((y+i*-1)*n)');
x7=0.5*exp((y+i*-1)*n);
subplot(2,5,7); stem(n,x7);
xlabel('Time'); ylabel('x(n)');
title('0.5*exp((y+i*-1)*n)');
x8=2*exp((y+i*-1)*n);
subplot(2,5,8); stem(n,x8);
xlabel('Time'); ylabel('x(n)');
title('2*exp((y+i*-1)*n)');
x9=1*exp((y+i*-0.5)*n);
subplot(2,5,9); stem(n,x9);
xlabel('Time'); ylabel('x(n)');
title('1*exp((y+i*-0.5)*n');
x10=1*exp((y+i*-2)*n);
subplot(2,5,10); stem(n,x10);
xlabel('Time'); ylabel('x(n)');
title('1*exp((y+i*-2)*n)');

12
OUTPUT:

FIGURE Task : 02bservation:

Task : 07

Generate the following Continuous time signals in MATLAB using the built-in
functions “sawtooth” and “square”.(Mention Time period in each plot and
keep in mind the amplitude value of any signal should not be less than zero
at any instant. Paste single Output figure use subplot command with proper
title,xlabel,ylabel)

I. Periodic Triangular wave.


II. Periodic Sawtooth wave.
III. Periodic Square wave.

13
CODE:

%%task 7
y=0:0.01:20;
w=square(x);
y=sawtooth(x);
subplot(3,3,1:3)
plot(x,w,'linewidth',4)
title('Different types of waves')
xlabel('Time Axis')
ylabel('Square')
subplot(3,3,4:6)
plot(x,y,'linewidth',4)
xlabel('Time Axis')
ylabel('Sawtooth')
subplot(3,3,7:9)
q=1:11;
t=[0 1 0 1 0 1 0 1 0 1 0];
plot(q,t,'linewidth',4)
xlabel('Time Axis')
ylabel('Triangular')

OUTPUT:

FIGURE Task : 02bservation:

14
Task : 08

Write a MATLAB code for this expression. Output should contain single figure
with three plots x1(n) in subplot(2,2,1) plots x2(n) in subplot(2,2,2) plots y(n)
in subplot(2,2,[3 4]). Label the axis and title every subplot.(Use the command
“suptitle” for whole figure title)
y(n) = x1(n) + x2(n), where
x1(n) = 2δ(n-3) & x2(n) = -δ(n+1)

CODE:

%%task 8
n=[-20:0.001:20];
q=size(n);
m1=zeros(q);
m1(n==3)=1;
x1=3*m1;
subplot(2,2,1);
plot(n,x1,'b');
title('Ploting 2s(n-3)')
xlabel('time axis n');
ylabel('x1(n)=2s(n-3)')
m2=zeros(q);
m2(n==-1)=1;
x2=-1*m2;
subplot(2,2,2);
plot(n,x2,'b');
title('Ploting -s(n+1)');
xlabel('time axis n') ;
ylabel('x1(n)=-s(n+1)')
x=x1+x2;
subplot(2,2,3:4);
plot(n,x,'b');
title('Ploting x(n)');
xlabel('time axis n') ;
ylabel('x(n)=x1(n)+x2(n)');

15
OUTPUT:

FIGURE

Task : 09

Plot(2D & 3D both)the following signals in MATLAB. Determine whether or


not the following signals are periodic. If a signal is periodic, specify its
fundamental period. Explain the results accordingly.(Paste single Output
figure for each part use subplot command with proper title,xlabel,ylabel)
(Exercise Problem 1.9)
i. x1(t) = jej10t
ii. x2(t) = je(-1+j)t
iii. x3(n) = ej7лn
iv. x4(n) = 3ej3л(n+1/2)/5

16
CODE:
2-D

%%task 9
t=-10:10;
x1=j*exp(j*10*t);
subplot(2,2,1);
plot(t,x1);
xlabel('x-axis')
ylabel('y-axis')
title('x1')
x2=j*exp(((-1)+j)*t)
subplot(2,2,2)
plot(t,x2);
xlabel('x-axis')
ylabel('y-axis')
title('x2')
n=-20:20;
x3=exp(j*7*pi*n)
subplot(2,2,3)
plot(n,x3);
xlabel('x-axis')
ylabel('y-axis')
title('x3')
x4=3*exp((j*3*pi)*((n+1)/2)/5)
subplot(2,2,4)
plot(n,x4);
xlabel('x-axis')
ylabel('y-axis')
title('x4')

OUTPUT:

FIGURE

17
CODE:
3-D

%%task 9
t=-10:10;
m=t;
x1=j*exp(j*10*t);
subplot(2,2,1); plot3(t,x1,m)
xlabel('x-axis') ylabel('y-axis') zlabel('z-axis')
title('x1')
x2=j*exp(((-1)+j)*t);
subplot(2,2,2); plot3(t,x2,m)
xlabel('x-axis') ylabel('y-axis') zlabel('z-axis')
title('x2')
n=-10:10;
x3=exp(j*7*pi*n)
subplot(2,2,3); stem3(n,x3,m);
xlabel('x-axis') ylabel('y-axis') zlabel('z-axis')
title('x3')
x4=3*exp((j*3*pi)*((n+1)/2)/5)
subplot(2,2,4); stem3(n,x4,m);
xlabel('x-axis') ; ylabel('y-axis'); zlabel('z-axis')
title('x4')

OUTPUT:

FIGURE

18
Task : 10

Consider the discrete time signal x(n) = u(n),-6 ≤ n ≤ 7.Write a MATLAB code
and verify that a signal is composed of two parts Even &Odd . Explains the
steps involved in it.(Paste single Output figure use subplot command with
proper title,xlabel,ylabel).

CODE:

%%task 10
n=[-20:20];
q=size(n);
x=zeros(q);
x(n==-6)=1;x(n==-5)=1;x(n==-4)=1;x(n==-3)=1;x(n==-2)=1;
x(n==-1)=1;x(n==0)=1;x(n==1)=1;x(n==2)=1;x(n==3)=1;
x(n==4)=1;x(n==5)=1;x(n==6)=1;x(n==7)=1;
subplot(3,2,1:2)
stem(n,x); title('Orignal Plot')
xm=x;
xm(n==-7)=1;xm(n==7)=0;
x1=0.5*(x+xm);
subplot(3,2,3); stem(n,x1); title('Even Part Of Signal')
x2=0.5*(x-xm);
subplot(3,2,4); stem(n,x2); title('Odd Part Of Signal')
x3=x1+x2;
subplot(3,2,5:6); stem(n,x3); title('Even+Odd Signal')

OUTPUT:

FIGURE

19

You might also like