0% found this document useful (0 votes)
55 views24 pages

Experiment - 1 AIM: Represent The Discrete Time Signal:: X (N) (2n,-3 N 3 0, Otherwise)

The document contains summaries of 10 experiments related to representing and analyzing discrete time signals: 1. The first experiment represents the discrete time signal x(n)={2n,-3<=n<=3, 0 otherwise} and plots the result. 2. The second experiment represents discrete impulse signals δ(n), δ(n-2), and δ(n+3) and plots each. 3. The third experiment generates the signal e^(jπ/8n) from 0 to 32 and plots its real, imaginary, absolute, and angle values. 4. The fourth experiment performs mathematical operations like addition and multiplication on two signals and plots the results.

Uploaded by

Rishab Singla
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)
55 views24 pages

Experiment - 1 AIM: Represent The Discrete Time Signal:: X (N) (2n,-3 N 3 0, Otherwise)

The document contains summaries of 10 experiments related to representing and analyzing discrete time signals: 1. The first experiment represents the discrete time signal x(n)={2n,-3<=n<=3, 0 otherwise} and plots the result. 2. The second experiment represents discrete impulse signals δ(n), δ(n-2), and δ(n+3) and plots each. 3. The third experiment generates the signal e^(jπ/8n) from 0 to 32 and plots its real, imaginary, absolute, and angle values. 4. The fourth experiment performs mathematical operations like addition and multiplication on two signals and plots the results.

Uploaded by

Rishab Singla
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/ 24

101489004

EXPERIMENT -1

AIM: Represent the discrete time signal:


x(n)={2n,-3<=n<=3
0,otherwise}

PROGRAM:
clc
clear all
q=input('enter the limit:');
n = [-q:q];
for i = 1:length(n)
if n(i)>=-3
if n(i)<=3
y(i) = 2*n(i);

else
y(i) = 0;

end
end
end
stem(n,y)
101489004

OUTPUT:
101489004

EXPERIMENT -2

AIM: Represent the discrete time signal:


(i):x1(n)= (n)
(ii):x2(n)= (n-2)
(iii):x3(n)= (n+3)

PROGRAM:
clc
clear all
lower = input('Enter the lower limit = ');
upper = input('Enter the upper limit = ');
n = [lower:upper];
s = input('Enter shift = ');
y = zeros(1,length(n));
for i = 1:length(n)
y(i) = 0;
if (n(i)==0-s)
y(i) = 1;
else
y(i) = 0;

end
end
stem(n,y)
101489004

OUTPUT:

(n) (n-2)

(n+3)
101489004

EXPERIMENT -3

AIM: Represent the discrete time signal:

x(n)=e^(j/8n) for 0<=n<=32.


Plot its real value, imaginary value, absolute value and angle in
radian.

PROGRAM:
clc
clear all
n=0:32;
l=length(n);
x=0;
For i=1:l
x(i)=exp(j*pi*i/8);
end
y=real(x);
subplot(3,2,1)
stem(x)
title('real')
xlabel('n')
ylabel('real')

z=imag(x);
subplot(3,2,2)
stem(z)
title('imaginary')
xlabel('n')
ylabel('imaginary')

r=sqrt(x.*conj(x));
subplot(3,2,3)
stem(r)
title('absolute')
xlabel('n')
ylabel('absolute')

k=angle(x)
subplot(3,2,4)
stem(k)
title('degree')
xlabel('n')
ylabel('degree')

rad=k*pi/180;
subplot(3,2,5)
stem(rad)
title('radian')
xlabel('n')
ylabel('radian')
101489004

OUTPUT:
101489004

EXPERIMENT -4

AIM: Plot the two different signals:


x1=Sin[(pi/4).(0:15)]
x2=Cos[(pi/7).(0:15)]
and perform multiplication, addition, subtraction, division,
multiply by 2.

PROGRAM:
clc
clear all
lower = input('Enter the lower limit = ');
upper = input('Enter the upper limit = ');
n = [lower:upper]
y = zeros(1,length(n));
z = zeros(1,length(n));
for i = 1:length(n)
y(i) = sin(((pi)/4)*n(i));
z(i) = sin(((pi)/4)*n(i));
sum(i) = y(i)+z(i)
difference(i) = y(i) - z(i);
mul(i) = y(i).*z(i);
first_cube(i) = y(i).*y(i).*y(i);
second_cube(i)= z(i).*z(i).*z(i);
division_first(i) = ((y(i))./(z(i)));
mul_first(i) = (y(i)).*2;
mul_second(i) = (z(i)).*2;
101489004

multiply(i) = (y(i))*(z(i));
end
subplot(5,2,1)
stem(n,y)
title('Function x1')

subplot(5,2,2)
stem(n,z)
title('Function x2')

subplot(5,2,3)
stem(n,sum)
title('sum of x1 and x2')

subplot(5,2,4)
plot(n,difference)
title('difference of x1 and x2')

subplot(5,2,5)
plot(n,mul)
title('multiplication of x1 andf x2')

subplot(5,2,6)
plot(n,first_cube)
title('cube of x1')

subplot(5,2,7)
plot(n,second_cube)
title('cube of x2')
101489004

subplot(5,2,8)
plot(n,division_first)
title('division')

subplot(5,2,9)
plot(n,mul_first)
title('mul first by 2')

subplot(5,2,10)
plot(n,mul_second)
title('mul second by 2')

OUTPUT:
101489004

EXPERIMENT -5

AIM: Generate the following signal:


X[n]=e^j(pi/8)n for 0<n<32

PROGRAM:
clc
clear all
n=0:32;

l=length(n);

for i=1:l

x(i)=exp(j*(pi/8)*n(i));

end

stem(n,x)

title('function')

xlabel('n')

ylabel('x')
101489004

OUTPUT:
101489004

EXPERIMENT -6

AIM: Plot a discrete time signal Cos(pi*n/4) and compute the


mean value over the interval 0<=n<=16.

PROGRAM:
clc
clear all
lower = input('Enter the lower input = ');
upper = input('Enter the upper input = ');
n = [lower:upper];
y = zeros(1,length(n));

for i=1:length(n)
x(i) = cos((pi.*n(i))/4);
end

y = sum(x(i));
mean = y./length(n)

stem(n,x)
101489004

OUTPUT:
Enter the lower input = 0
Enter the upper input = 16
mean =
0.0588
101489004

EXPERIMENT -7

AIM:

PROGRAM: Consider the DT signal:


(i): x(n)=Sin((2*pi*M*n)/N)
and assume N=12 and for M=4,5,7,10 and plot the signal x(n)
on the interval 0<=n<=2N-1.
(ii)What is the fundamental period of each signal and also
consider the case when M>N.

PROGRAM:
clc
clear all
close all
N = input('Enter the value of N = ');
M = [4 5 7 10 13 15 16 18];

n = [0:(2*N-1)];
for i = 1:length(n)
for q= 1:length(M)
x(i,q) = sin((2*pi*M(q)*n(i))/N);

end
end
subplot(4,2,1)
stem(n,x(n+1,1))
101489004

title('FOR M=4')
ylabel('X(4)n')
xlabel('n')

subplot(4,2,2)
stem(n,x(n+1,2))
title('FOR M=5')
ylabel('X(5)n')
xlabel('n')

subplot(4,2,3)
stem(n,x(n+1,3))
title('FOR M=7')
ylabel('X(7)n')
xlabel('n')

subplot(4,2,4)
stem(n,x(n+1,4))
title('FOR M=10')
ylabel('X(10)')
xlabel('n')

subplot(4,2,5)
stem(n,x(n+1,1))
title('FOR M=13')
ylabel('X(13)n')
xlabel('n')

subplot(4,2,6)
stem(n,x(n+1,2))
101489004

title('FOR M=15')
ylabel('X(15)n')
xlabel('n')

subplot(4,2,7)
stem(n,x(n+1,3))
title('FOR M=16')
ylabel('X(16)n')
xlabel('n')

subplot(4,2,8)
stem(n,x(n+1,4))
title('FOR M=18')
ylabel('X(18)n')
xlabel('n')
101489004

OUTPUT:
101489004

EXPERIMENT -8

AIM: Generate square wave signal of frequency 50Hz and


sampling frequency 1000Hz and it's having duty cycle of
25%,50%,75%.

PROGRAM:
clc
clear all
f=50;
sf=1000;
d=25;
t = 0:1/sf:2;
y = square(2*pi*f*t,d);
subplot(2,2,1)
plot(t,y);
title('d=20')
axis([0 0.1 -1.5 1.5]);

d=50;
y = square(2*pi*f*t,d);
subplot(2,2,2)
plot(t,y);
title('d=50')
axis([0 0.1 -1.5 1.5]);

d=75;
y = square(2*pi*f*t,d);
subplot(2,2,3)
101489004

title('d=75')
plot(t,y);
axis([0 0.1 -1.5 1.5]);

OUTPUT:
101489004

EXPERIMENT -9

AIM: Plot a signum, step and impulse function by using zeros


and ones.

PROGRAM:
clc
clear all
n=input('n=');
a=-n:1:n;

t=[zeros(1,(length(a)-1)/2) ones(1) zeros(1,(length(a)-1)/2)];


SUBPLOT(2,2,1);
stem(a,t);
title('impulse')
xlabel('n')
ylabel('x(n)')

q=[-ones(1,(length(a)-1)/2) ones(1) ones(1,(length(a)-1)/2)];


subplot(2,2,2)
stem(a,q);
title('signum')
xlabel('n')
ylabel('x(n)')

y=[zeros(1,(length(a)-1)/2) ones(1,(length(a)+1)/2)];
subplot(2,2,3)
stem(a,y)
title('step')
101489004

xlabel('n')
ylabel('x(n)')
OUTPUT:
101489004

EXPERIMENT -10

AIM: Plot a function sin(x)/x.

PROGRAM:
clc
clear all
x=[-10*pi:0.1:10*pi]
y=sin(x)./x
plot(x,y);

OUTPUT:

You might also like