Experiment 1  Aim:To generate periodic and aperiodic discrete time signalsin MATLAB and perform basic operations: folding,...
Activity 2.x (n) = 2n+ sin (0.2πn)       -15 ≤ n ≤ 15(i) Plot x (n) u (2-n)   (ii) Plot x (n-2) [-2δ (n -4) -5δ (n -5) +3δ...
(iii)n=-15:15;x=2*n+sin(0.2*pi*n);                                   plot of x(n)                             plot of fold...
Activity 3.x (n) = [2 -3 4 -1 5 3 0 -2 6]                                 ↑(i)Plot x (n)             (ii)Plotx (-n)(iii)Pl...
Upcoming SlideShare
Loading in …5
×

Exp 1 (raghu)

312 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
312
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Exp 1 (raghu)

  1. 1. Experiment 1 Aim:To generate periodic and aperiodic discrete time signalsin MATLAB and perform basic operations: folding, shifting, addition multiplication and scaling. act:1(a) original signal 4 Activity 1. 3.5 x (n) = 2- (n/3) -5 ≤ n ≤-1 3 2.5 2 0≤n≤4 amplitude 2 (i) Sketch 100 samples of x (n) (ii) fold x(n) and then delay by five 1.5 samples (iii) Delay x (n) by five samples and then fold (iv) Sketch -2x (-n - 4) 1 0.5 Program 0 act 1(b) folded and shifted -5 -4 -3 -2 -1 0 1 2 3 4 clc; 4 time 3.5 clearall; 3 closeall; 2.5 amplitude n1=linspace(-5,-1,50); 2 n2=linspace(0,4,50); 1.5 x1=2-(n1/3); x2=2-(n2*0); 1 n=[n1,n2]; 0.5 x3=[x1,x2]; figure(name,activity 1(a) original signal) 0 1 2 3 4 5 6 7 8 9 10 stem(n,x3,color,green); time xlabel(time) 4 act 1(c) shift and fold ylabel(amplitude) 3.5 title(act:1(a) original signal) %% activity 1(b) 3[x4,n4]=sigfold(x3,n); 2.5 [x5,n5]=sigshift(x4,n4,5); amplitude figure(name,activity 1(b)) 2 stem(n5,x5); 1.5 xlabel(time) 1 ylabel(amplitude) title(act 1(b) folded and shifted) 0.5 %%activity 1 .(c) 0 [x6,n6]=sigshift(x3,n,5); -9 0 -8 -7 -6 -5 act:1(d) time -4 -3 -2 -1 0 [x7,n7]=sigfold(x6,n6); figure(name,activity 1 (c) shift and fold) -1 stem(n7,x7); -2 xlabel(time,color,red) -3 ylabel(amplitude,color,red) amplitude title(act 1(c) shift and fold) -4 %% act 1(d) -5 [x8,n8]=sigfold(x3,n); [x9,n9]=sigshift(x8,n8,4); -6 y=-(2*x9) -7 figure(name,act 1(d)) stem(n9,y,color,black) -8 0 1 2 3 4 5 6 7 8 9 time xlabel(time,color,black) ylabel(amplitude,color,black) title(act:1(d)) Saurabh Raj (101098)
  2. 2. Activity 2.x (n) = 2n+ sin (0.2πn) -15 ≤ n ≤ 15(i) Plot x (n) u (2-n) (ii) Plot x (n-2) [-2δ (n -4) -5δ (n -5) +3δ (n -6)] (iii) Plot even part of x (n)(iv)Plot odd part of x (n) plot of x(n) plot of x(n) plot of x(n) 30 1 01) 0.9n=-15:15; 20 -5 0.8x=2*n+sin(0.2*pi*n);[n1,x1]=unitstep(0,-15,15); 0.7 10 -10[x2,n2]=sigfold(x1,n1); 0.6[x3,n3]=sigshift(x2,n2,2); amplitude amplitude amplitudey=x.*x3; 0 0.5 -15subplot(1,3,1),stem(n,x) 0.4title(plot of x(n)) -10 -20xlabel(time) 0.3ylabel(amplitude) 0.2subplot(1,3,2),stem(n3,x3,color,green) -20 -25title(plot of x(n)) 0.1xlabel(time)ylabel(amplitude) -30 -20 0 20 0 -20 0 20 -30 -20 0 20subplot(1,3,3),stem(n3,y,color,green) time time timetitle(plot of x(n))xlabel(time)ylabel(amplitude) plot of impulse signal plot of shifted x(n) plot of y(n)2) 3 30 0[na,ya]=impulse(4,-15,15) -5[nb,yb]=impulse(5,-15,15) 2[nc,yc]=impulse(-6,-15,15) 20 -10n6=na+nb+nc 1y=(-2*ya)+(-5*yb)+(3*yc) -15 10 0n=-15:15 -20 amplitude amplitudex=2*n+sin(0.2*pi*n) amplitude[x1,n1]=sigshift(x,n,2); -1 0 -25y1=y.*x1; -30subplot(1,3,1),stem(n6,y) -2xlabel(time) -10 -35ylabel(amplitude) -3title(plot of impulse signal) -40subplot(1,3,2),stem(n1,x1) -20 -4xlabel(time) -45ylabel(amplitude)title(plot of shifted x(n)) -5 -30 -50 -50 0 50 -20 0 20 -20 0 20subplot(1,3,3),stem(n1,y1) time time timexlabel(time)ylabel(amplitude)title(plot of y(n))Saurabh Raj (101098)
  3. 3. (iii)n=-15:15;x=2*n+sin(0.2*pi*n); plot of x(n) plot of folded x(n) plot of x(n)+x(-n) plot of even part of x(n) 30 30 1 1[x1,n1]=sigfold(x,n);[x2,n2]=sigadd(x1,n1,x,n); 0.8 0.8y=x2/2; 20 20subplot(1,4,1),stem(n,x) 0.6 0.6title(plot of x(n))xlabel(time) 10 10 0.4 0.4ylabel(amplitude) 0.2 0.2subplot(1,4,2),stem(n1,x1) amplitude amplitude amplitude amplitudetitle(plot of folded x(n)) 0 0 0 0xlabel(time)ylabel(amplitude) -0.2 -0.2subplot(1,4,3),stem(n2,x2) -10 -10 -0.4 -0.4title(plot of x(n)+x(-n))xlabel(time) -0.6 -0.6ylabel(amplitude) -20 -20subplot(1,4,4),stem(n2,y) -0.8 -0.8title(plot of even part of x(n))xlabel(time) -30 -20 0 20 -30 -20 0 20 -1 -20 0 20 -1 -20 0 20ylabel(amplitude) time time time time plot of x(n) plot of folded x(n) plot of x(n)+x(-n) plot of even part of x(n)(iv) 30 30 60 30n=-15:15;x=2*n+sin(0.2*pi*n); 20 20 40 20[x1,n1]=sigfold(x,n);[x2,n2]=sigadd(-1*x1,n1,x,n);y=x2/2; 10 10 20 10subplot(1,4,1),stem(n,x)title(plot of x(n)) amplitude amplitude amplitude amplitudexlabel(time)ylabel(amplitude) 0 0 0 0subplot(1,4,2),stem(n1,x1)title(plot of folded x(n))xlabel(time) -10 -10 -20 -10ylabel(amplitude)subplot(1,4,3),stem(n2,x2)title(plot of x(n)+x(-n)) -20 -20 -40 -20xlabel(time)ylabel(amplitude)subplot(1,4,4),stem(n2,y)title(plot of even part of x(n)) -30 -30 -60 -30 -20 0 20 -20 0 20 -20 0 20 -20 0 20xlabel(time) time time time timeylabel(amplitude)Saurabh Raj (101098)
  4. 4. Activity 3.x (n) = [2 -3 4 -1 5 3 0 -2 6] ↑(i)Plot x (n) (ii)Plotx (-n)(iii)Ploteven part ofx (n)(iv)Plotodd part ofx (n)clcclearallclosealln=-4:4;x=[2 -3 4 -1 5 3 0 -2 6]subplot(2,2,1),stem(n,x,color,red);xlabel(n--->,color,red)ylabel(amplitude,color,red)title(activity 3a,color,red)[x1,n1]=sigfold(x,n);subplot(2,2,2),stem(n1,x1,color,green);xlabel(n-->,color,green)ylabel(amplitude,color,green)title(activity 3b,color,green) [x2,n2]=sigadd(x,n,x1,n1);y1=x2/2;subplot(2,2,3),stem(n2,y1,color,red);xlabel(n->,color,red)ylabel(amplitude,color,red)title(even part of x[n],color,red)x3=-x1;[x4,n4]=sigadd(x,n,x3,n1);y2=x4/2;subplot(2,2,4),stem(n4,y2);xlabel( ...n...)ylabel(---x[n]--->)title(odd part of x[n]) activity 3a activity 3b 10 10 5 5 amplitude amplitude 0 0 -5 -5 -4 -2 0 2 4 -4 -2 0 2 4 n---> n--> even part of x[n] odd part of x[n] 5 2 1 amplitude ---x[n]---> 0 0 -1 -5 -2 -4 -2 0 2 4 -4 -2 0 2 4 n-> ...n...Saurabh Raj (101098)

×