Lab p2
Lab p2
N=4
N=4
N = 4
x=[1,2,3,6];
xk=fft(x,N);
Phase spectrum
subplot(3,1,3);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
1
N=8
N=8
N = 8
x=[1,2,3,6];
xk=fft(x,N);
2
Phase spectrum
subplot(3,1,3);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
N = 8
x=[1,2,3,6];
n1=0:7;
x=cos(2*pi*n1*250/8000);
%x is a sequence of 250Hz with
%fs=8kHz
xk=fft(x,N);
3
stem(n1,x);
xlabel(' n');
ylabel('x[n]');
title('original signal');
Phase spectrum
subplot(3,1,3);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
4
N = 80
x=[1,2,3,6];
n1=0:7;
x=cos(2*pi*n1*250/8000);
%x is a sequence of 250Hz with
%fs=8kHz
xk=fft(x,N);
Phase spectrum
subplot(3,1,3);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
5
When: n1=0:79; x=cos(2*pi*n1*250/8000); %x[n] sequence of 250Hz with
fs=8kHz, & N=80 point DFT
N=80
N = 80
x=[1,2,3,6];
n1=0:79;
x=cos(2*pi*n1*250/8000);
%x is a sequence of 250Hz with
%fs=8kHz
xk=fft(x,N);
6
subplot(3,1,2);
stem(n,abs(xk));
xlabel(' k');
ylabel('lxkl');
title('Magnitude spectrum');
Phase spectrum
subplot(3,1,3);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
N = 160
x=[1,2,3,6];
n1=0:79;
x=cos(2*pi*n1*250/8000);
%x is a sequence of 250Hz with
%fs=8kHz
xk=fft(x,N);
7
Plot of input sequence
n=0:1:N-1;
subplot(3,1,1);
n1=0:1:length(x)-1;
stem(n1,x);
xlabel(' n');
ylabel('x[n]');
title('original signal');
Phase spectrum
subplot(3,1,3);
stem(n,angle(xk));
xlabel(' k');
ylabel('angle(xk)');
title('phase spectrum');
8
Inference
%%N point dft of given signal is computed and magnitude and phase spectrum are plotted