clear Fs = 500000; % Sampling frequency T = 1/Fs; % Sample time L = 3000; % Length of signal t = (0:L-1)*T; % Time vector a=0.5; f1=5000; f2=100000; f3=60000; w1=2*pi*f1; w2=2*pi*f2; w3=2*pi*f3; s=(1-a*sin(w1*t)).*sin(w2*t).*sin(w3*t); for i=1:length(s) if s(i)>0 y(i)=s(i); else y(i)=0; end end plot(Fs*t,y) title('Signal détecté') xlabel('time (milliseconds)') NFFT = 2^nextpow2(L); % Next power of 2 from length of y Y = fft(y,NFFT)/L; Z= fft(s,NFFT)/L; f = Fs/2*linspace(0,1,NFFT/2+1); % % % Plot single-sided amplitude spectrum.* figure(2) subplot(2,1,1) plot(f,2*abs(Z(1:NFFT/2+1))) title('Spectre du signal avant détection') xlabel('Frequency (Hz)') ylabel('|Y(f)|') grid subplot(2,1,2) plot(f,2*abs(Y(1:NFFT/2+1))) title('Spectre du signal détecté') xlabel('Frequency (Hz)') ylabel('|Y(f)|') grid