EE-338. DSP. Computation Assignment 2 Palash Jhabak 08d07044
EE-338. DSP. Computation Assignment 2 Palash Jhabak 08d07044
FFT of the singal + noise with first being a 100 point FFT and second being a 1000 point FFT
FFT of the filtered signal with Hamming window of length 50 ( first if FFT with 100 points and second is with 1000 points ).
FFT of the filtered signal with Hamming window of length 100 ( first if FFT with 100 points and second is with 1000 points ).
FFT of the filtered signal with Kaiser window of length 50 ( first if FFT with 100 points and second is with 1000 points ).
FFT of the filtered signal with Kaiser window of length 100 ( first if FFT with 100 points and second is with 1000 points ).
Observations 1. It can be seen from the above 6 graphs that the a larger length dft gives a more correct measurement of frequency estimation. 2. Output with normal fft is similar to that of with Kaiser Window 3. Hamming window gives a more elongated/brader fft peaks, due to smoothening of edges. 4. Hamming window is better than rectangular window Code a1=100; % Declaring parameters for the Sinosoidal wave a2=25; f1=100; f2=150; fs=1000; % sampling frequency %n=[1:1000]; for n=1:1000 x1(n)=a1*sin(2*pi*f1*n/fs); %1st sine wave x2(n)=a2*sin(2*pi*f2*n/fs); %2nd sine wave x(n)=x1(n)+x2(n); %required signal end x1_fft=abs(fft(x1,1000)); x2_fft=abs(fft(x2,1000)); x_fft=abs(fft(x,1000)); y=awgn(x,12,'measured'); %adding additive white guassian noise to the signal x . adding % 'measured' will ensure that it calculates the % signal power before adding noise. y_fft_100=abs(fft(y,100)); y_fft_1000=abs(fft(y,1000)); hamming_50=hamming(50); % creating hamming windows hamming_100=hamming(100); kaiser_50=kaiser(50); kaiser_100=kaiser(100);
%x_hammed50=x.*hamming_50'; % point wise multiplying with the transpose % of the hamming window for a=1:100 x_hammed100(a)=x(a)*hamming_100(a); end for b=1:50 x_hammed50(b)=x(b)*hamming_50(b); end for c=1:100
xhammed50_fft_100=abs(fft(x_hammed50,100)); xhammed50_fft_1000=abs(fft(x_hammed50,1000)); xhammed100_fft_100=abs(fft(x_hammed100,100)); xhammed100_fft_1000=abs(fft(x_hammed100,1000)); xkaiser50_fft_100=abs(fft(x_kaiser50,100)); xkaiser50_fft_1000=abs(fft(x_kaiser50,1000)); xkaiser100_fft_100=abs(fft(x_kaiser100,100)); xkaiser100_fft_1000=abs(fft(x_kaiser100,1000)); gcf1=figure(1); set(gcf1,'name','FFT of the signal with noise. 100pt and 1000pt. respectively','numbertitle','off') subplot(1,2,1); plot(y_fft_100); subplot(1,2,2); plot(y_fft_1000); gcf2=figure(2); set(gcf2,'name','FFT with hammed window of length 100. 100pt and 1000pt. respectively','numbertitle','off') subplot(1,2,1); plot(xhammed100_fft_100); subplot(1,2,2); plot(xhammed100_fft_1000); gcf3=figure(3); set(gcf3,'name','FFT with hammed window of length 50. 100pt and 1000pt. respectively','numbertitle','off') subplot(1,2,1); plot(xhammed50_fft_100); subplot(1,2,2); plot(xhammed50_fft_1000);
gcf4=figure(4); set(gcf4,'name','FFT with kaiser window of length 100. 100pt and 1000pt. respectively','numbertitle','off') subplot(1,2,1); plot(xkaiser100_fft_100); subplot(1,2,2); plot(xkaiser100_fft_1000); gcf5=figure(5); set(gcf5,'name','FFT with kaiser window of length 50. 100pt and 1000pt.
respectively','numbertitle','off') subplot(1,2,1); plot(xkaiser50_fft_100); subplot(1,2,2); plot(xkaiser50_fft_1000); gcf6=figure(6); set(gcf6,'name','Signal witn noise in time domain','numbertitle','off') plot(y);