0% found this document useful (0 votes)
25 views3 pages

DSP Lab1

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)
25 views3 pages

DSP Lab1

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/ 3

1) %generation of random signal

N=input(‘enter the value of n:’);

n = 0:N-1;

x=random(1,N);

figure;

Subplot(2,1,1);

Plot(n,x);

Xlabel(‘ ‘);

Ylabel(‘X’);

title(‘continuous random signal’);

subplot(2,1,2);

stem(n,x);

xlabel(‘n’);

ylabel(‘X’);

title(‘discrete random signal’);

.
3-iv) % Auto correlation

Clc;

Clear all;

Close all;

x=input(‘enter the sequence x(n):’);

n=length(x);

z=flip(x);

m=length(z);

l1=0:n-1;

figure;

subplot(2,1,1);

stem(l1,x);

title(‘input sequence x(n) is :’);

xlabel(‘----> n’);

ylabel(‘---->x(n)’);

grid;

x=[x,zeros(l,m)];

z=[z,zeros(l,n)];

disp(‘auto correlation of x(n) & X(n) is Y(n):’);

y=zeros(l,m+n-1);

for i=1:m+n-1

y(i)=0;

for j=1:m+n-1

if(j<i+1)

y(i)=y(i)+z(j)*x(i-j);

end

end

end

disp(y);

l2= -(n-1):(n-1);

subplot(2,1,2);
stem(l2,y);

title(‘auto correlation of x(n) & X(n) is :’);

xlabel(‘--->n’);

ylabel(‘--->y(n)’);

grid;

You might also like