Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
32 views5 pages

Untitled Document

The document contains MATLAB code snippets for signal processing tasks, including signal generation, shifting, multiplication, and addition. It demonstrates the creation of periodic sequences, even and odd signal components, and the use of ramp functions. Various plots are generated to visualize the original and processed signals.

Uploaded by

Md Ifrat Rahman
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)
32 views5 pages

Untitled Document

The document contains MATLAB code snippets for signal processing tasks, including signal generation, shifting, multiplication, and addition. It demonstrates the creation of periodic sequences, even and odd signal components, and the use of ramp functions. Various plots are generated to visualize the original and processed signals.

Uploaded by

Md Ifrat Rahman
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/ 5

eva

2.
n = [-8:12];

x=exp(0.1*n).* (u(-5, -8, 12)-u (10, -8,12));

[xe, xo,m] = evenodd (x, n); [xe,xo,m]

subplot (3,1,1);

stem (n,x);

title('original signal')

xlabel('n');

ylabel('x(n)');

axis ([-15,15,-4,4])

subplot (3,1,2);

stem(m,xe);

title('even part')

xlabel('n');

3.
n = [0:6];

X x = [-5,-2,1,4,6,8,10];

[x11, nl1] = sigshift (x,n,-4);

[x12,n12] = sigshift (x,n,1);

[x1,nl] = sigmult (x11, nl1,x12, n12);

[x13, n13] =sigshift (x,n,-4);


[x2,n2]= sigadd (x1, nl, 4*x13,n13);

[x3, n3]=sigadd (x2, n2, 3*x, n);

subplot (3,1,1);

stem (n3, x3);

axis ([-6,8,-40, 40])

Hw
1.
n=[0:3]';

x= [1,2,3,4];

N=4;

y= repmat (x,N); m=0:1:size (y)-1; subplot (2,1,1); stem (m, y)

title('Periodic sequence') axis ([-1,4,-5,5]);

2.
n=[-3:4];

x= [1,2,6,5,4,6,8,10];

[x11, nl1]-sigshift (x,n,-2);

[x12, n12]-sigshift (x, n, 4);

[x13,n13] =sigadd (3*x11, n11,x12, n12);

[x1, n1]=sigadd (x13, n13, -2*x,n); subplot (2,1,1);

stem (n1,x1);

axis ([-6,10,-40, 40])

3.
function r
r = max (0,x) ramp (x)
4.
i.
n=-10:10;

x=ramp (n);

subplot (2,1,1);

plot (n,x);

title('Original Signal')

xlabel('n');

ylabel('x(n));

axis ([-11 11 -5 12]); subplot (2,1,2);

stem (n,x);

title('DT Signal')

xlabel('n');

ylabel('x(n));

axis ([-11 11 -5 12]);


ii.
n=1-50:50];

x = cos (0.25*pi*n);

k = 5;

z=downsample (x, k);

subplot (2,1,1)

stem (n,x);

title ('Original sequence')

xlabel('n');

ylabel('x(n)');
axis ([-52,52,-1.5, 1.5]);

m=[0:length(z)-1];

subplot (2,1,2)

stem (m, z)
iii.
x= [1,-2,6,-5,4,6,8,10]; n = [0:length(x)-1];

for k=1:5,

x1 zeros (1,8);

[x11, nl1]=sigshift (x,n,k);

[x2,n2]=sigadd (x11, nl1, n. *x11, nl

end

subplot (2,1,1);

stem (n2, x2);

axis ([5,15,-30,901);

5.
n=[-25:25];

x1=5* (u(0,-25,25)-u (20,-25,25));

x2=5* (u (1,-25,25)-u (21,-25,25));

y=x1-x2;

stem (n,y);

axis ([-30,30,-7,7]);
...
n=[-0:110];

x1=sin((pi. *n/25)).* (u(0,0,110)-u (100,0,110)); x2=sin((pi. *n/25)).*(u(1,0,110)-u (101,0,110));


y=x1-x2; stem (n, y);
axis ([-5,120,-.1,.1]);

You might also like