Skip to content
Snippets Groups Projects
Commit 9f321394 authored by VATON Samuel's avatar VATON Samuel
Browse files

SAR.mlx

parent beebc534
Branches
No related tags found
No related merge requests found
SAR.mlx 0 → 100644
File added
fe = 10e3; % Fréquence d'échantillonnage
T = 1/10;
Te=1/fs;
t = -1:1/fs:1; % Durée du signal
x_1 =square(2*pi*t/T);
%fft
X_1 = 10*log10(abs(fftshift(fft(x_1))));
N =length(t) ;
freq = (-N/2:N/2-1)*(1/(Te*N));
figure;
stem(freq, X_1, '.') % Tracé du signal
xlabel('f (Hz)')
ylabel('10log(|X_1|)')
title('spectre du signal carré');
x_2 = sawtooth(2*pi*t/T);
plot(t,x_2)
title('sawtooth')
%fft
X_2 = 10*log10(abs(fftshift(fft(x_2))));
figure;
stem(freq, X_2, '.')
xlabel('f (Hz)')
ylabel('10log(|X_1|)')
title('spectre du signal en dent de scie');
%question 2.2------------------------------------------
% Filtrage : y(k) = 1/2 (x(k) + x(k-1))
b=[1/2,1/2];
a=1;
y = filter(a,b,x_1);
% FFT
X1 = 20*log10(abs(fftshift(fft(x_1))));
Y = 20*log10(abs(fftshift(fft(y))));
f = (-N/2:N/2-1)*(1/(Te/N)); % Axe fréquentiel
f_lin=linspace(-1/(2*Te),1/(2*Te),N);
disp(f_lin)
% Réponse théorique du filtre
H = (1/2*abs(1+exp(-2*1i*pi*f_lin*Te))).^2;
% Affichage
figure;
subplot(3,1,1);
plot(t, x_1); title('Signal d''entrée x(k)');
subplot(3,1,2);
plot(t, y); title('Signal filtré y(k)');
subplot(3,1,3);
plot(f_lin, abs(Y), 'b', 'DisplayName', '|Y(f)|^2');
hold on;
plot(f_lin, abs(X2).*H, 'r', 'DisplayName', '|X(f)|^2 × |H(f)|^2 (théorique)');
legend; xlabel('Fréquence (Hz)');
title('Spectre de sortie comparé à la théorie');
xlim([-10 10]);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment