FFT and Convolution for FFT with Waveforms

By
Advertisement
clc;
clear all;
close all;
x=input('enter the sequence');
N=input('enter the number of smples');
n=0:N-1
y=fft(x,N);
y1=abs(y);
y2=angle(y);
y3=ifft(y);
figure(1);
subplot(2,1,1);
stem(x);
title('original signal');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(y);
title('fft signal');
xlabel('samples');
ylabel('amplitude');
figure(2);
subplot(2,1,1);
stem(y1);
title('magnitude plot');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(y2);
title('phase angle');
xlabel('samples');
ylabel('amplitude');
figure(3);
subplot(2,1,1);
stem(y);
title('frequency domain sequence');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(y3);
title('invers fft signal');
xlabel('samples');
ylabel('amplitude');





% CONV FOR FFT
clc;
clear all;
close all;
x=input('enter sequence of x');
h=input('enter sequence of h');
X1=[x zeros(1,length(h)-1)];
disp('X1=');
disp(X1);
h1=[h zeros(1,length(x)-1)];
disp('h1=');
disp(h1);
X=fft(x1);
H=fft(h1);
y=X.*H;
y1=ifft(y);
disp('the conv y1=');
disp(y1);
figure(1);
subplot(5,1,1);
stem(x);
title('input signal 1');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,2);
stem(h);
title('input signal 2');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,3);
stem(X1);
title('fft signal 1');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,4);
stem(h1);
title('fft signal 2');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,5);
stem(y1);
title('conv signal');
xlabel('samples');
ylabel('amplitude');

0 comments:

Post a Comment