1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| clear
fe=200;T=1/fe;t=(1:fe)/fe;f=10;
x=cos(2*pi*f*t);%Signal origine
plot(x);grid
y = conv(x,x);%Convolution x par x
Nx = length(y);
figure(2)
subplot(221)
plot(t,y(1:length(t)));
xlabel('temps');grid
% fft de y
subplot(222)
tf=fft(y,Nx);
w=(0:Nx-1)/Nx*fe;
plot(w,abs(tf(1:Nx)));
grid
xlabel('fréquences en Hz')
title('module de la fft')
subplot(223)
w=(0:Nx-1)/Nx*fe;
stem(w,abs(tf(1:Nx)));
grid
xlabel('fréquences en Hz')
title('module de la fft')
Gabarit=5000*ones(1,length(w));
for i=1:Nx;
g(i)=tf(i)*heavi(abs(tf(i))-Gabarit);
end
%ifft
subplot(224)
tf=ifft(g,Nx);
plot(t,real(tf(1:length(t))));grid
xlabel('temps')
title('signal origine par transformée inverse')
figure(3)
subplot(221)
plot(w,abs(g(1:Nx)));;grid
Title('Spectre filtré','FontSize',13)
subplot(222)
tf=fft(y,Nx);
w=(0:Nx-1)/Nx*fe;
plot(w,abs(tf(1:Nx)));
hold on
for k=1:5
plot(w,Gabarit,'r','LineWidth',3);
end
grid;Title('Gabarit','FontSize',13) |
Partager