Professional Documents
Culture Documents
Exercise of Lab # 03
Draw the following signals:
Q1) Exponential
(a) X(t)=5e^-6t
T=0:01:1;
A=00.1;
B=-6;
x=A*exp(B*T);
plot (T,x)
grid on
title(' Continuous time exponential signal)
xlabel('T')
ylabel('A')
legend('Exponential signal')
(b) Y (t)=3e^3t
T=0:01:1;
A=3;
B=-3;
x=A*exp(B*T);
plot (T,x)
grid on
title(' Continuous time exponential signal)
xlabel('T')
ylabel('A')
legend('Exponential signal')
IJAZ UL HAQ CMS ID: 33210
(c) X[n]=2(0.85)n
N=0:0.01:1;
A=2;
x=A*(0.85)*N;
stem (N,x)
grid on
title(' Discrete time exponential signal')
xlabel('N')
ylabel('A')
legend(' Discrete Exponential signal')
(d) X[n]=2(exp)^2n
N=0:0.01:1;
A=2;
B=2;
x=A*exp(B*N);
stem (N,x)
grid on
title(' Discrete time exponential signal')
xlabel('N')
ylabel('A')
legend(' Discrete Exponential signal')
IJAZ UL HAQ CMS ID: 33210
Q2) Sinusoidal
time=0:0.001:1;
amplitude=8;
frequency=10;
w=2*pi*frequency;
x=amplitude*cos(w*time);
plot(time,x)
grid on
title('Cos Signal')
time=0:0.001:0.1;
amplitude=20;
frequency=100;
w=2*pi*frequency;
x=amplitude*sin(w*time);
plot(time,x)
grid on
title(' Sine signal')
IJAZ UL HAQ CMS ID: 33210
Q3) Impulse
N=10:1:10;
x=[zeros(1,10),1,zeros(1,10)];
stem (N,x);
grid on
title(' Unit Impulse Signal')
xlabel('N')
ylabel('x')
N=(-1:001:1);
impulse=T==0;
stem (T,impulse);
grid on
title(' Continuous Time Impulse Signal')
xlabel('T')
ylabel('A')
IJAZ UL HAQ CMS ID: 33210
Q4) Step
N=4; % no of sample
N=-N:1:N;
N= [-4 -3 -2 -1 0 1 2 3 4]
x= [zeros(1,N) 1 ones(1,N)]
x= [0 0 0 0 1 1 1 1 1]
stem(n,x);
grid on
xlabel ('Time');
ylabel('Amplitude');
title('Unit Step');
T=4; % no of sample
t=-T:1:T;
T= [-4 -3 -2 -1 0 1 2 3 4]
x= [zeros(1,T) 1 ones(1,T)]
x= [0 0 0 0 1 1 1 1 1]
stem(t,x);
grid on
xlabel ('Time');
ylabel('Amplitude');
title('Unit Step');
IJAZ UL HAQ CMS ID: 33210
Q5) Ramp
Q6) Sinc
(a) Get helpfor for built in function “sinc” and hence plot sinc function
(sin(x)\x) for x between -5 to 5.
x=linspace(-5,5);
y=sinc(x);
plot(x,y)
grid on
title('Sinc Function')
xlabel('x')
ylabel('y')
t=0:0.001:2;
w=3;
x=rectpuls(t,w);
plot(t,x)
plot(t,w)
grid on
title('rectangular pulse function')
xlabel('t')
ylabel('A')
IJAZ UL HAQ CMS ID: 33210
t=0:0.001:2;
A=5;
x=t\(t.^2+4);
plot (t,x)
grid on
title(' Continuous time signal')
xlabel('t')
ylabel('A')