diff --git a/signal/matlab/SimuGuns.slx b/signal/matlab/SimuGuns.slx new file mode 100644 index 0000000..4059009 Binary files /dev/null and b/signal/matlab/SimuGuns.slx differ diff --git a/signal/matlab/SimulDFT.slx b/signal/matlab/SimulDFT.slx new file mode 100644 index 0000000..1c99b5c Binary files /dev/null and b/signal/matlab/SimulDFT.slx differ diff --git a/signal/matlab/scriptDFT.m b/signal/matlab/scriptDFT.m index 3f15a93..cc2bcd1 100644 --- a/signal/matlab/scriptDFT.m +++ b/signal/matlab/scriptDFT.m @@ -1,31 +1,173 @@ +%% +%TUTO BAC A SABLE +figure(1); +plot(Res.Sinus_Continu); +hold on; +plot(Res.Sinus_Echanti,'o'); +grid; +title('Courbe temporelle du Sinus'); + +tab = linspace(0,M-1,M); +tab = tab*(Fe/M); +r = fft(Res.Sinus_Echanti.data); + +figure(2); +stem(tab,abs(r/M)); +grid; +title('Module de la TFD en fonction de la fréquence'); + + +%% +%QUESTION 1 ET 2 clear all; close all; +clc; -%% Paramètres -T = 0.25; % Fenêtre d'observation -M=32; % Nombre d'échantillons dans la fenêtre +Fe = 320000; +Te = 1/Fe; +T = 1/5000; +M = T/Te; +Tsim = T-Te; +F1 = 85000; +F2 = 90000; +F3 = 95000; +F4 = 100000; +F5 = 115000; +F6 = 120000; -%% Paramètres déduits -Te = T/M; % Période d'échantillonnage -Tsim = T-Te; % Instant final de simulation -Fsin = 4 ; -%% Calculs préliminaires +Res = sim('SimuGuns'); +echelle_freq = linspace(0,M-1,M)*(Fe/M); +r = fft(Res.Echanti.data); +figure(1); +plot(Res.Continu); +grid; -%% Lancement de simulink -out=sim("simDFT") +figure(2); +plot(echelle_freq,abs(r/M),'o'); +grid; +%% +%QUESTION 3 +clear all; +close all; +clc; + +Fe = 320000; +Te = 1/Fe; +T = 1/5000; +M = T/Te; +Tsim = T-Te; + +F1 = 85005.9; +F2 = 90000; +F3 = 94846.8; +F4 = 100000; +F5 = 115015.9; +F6 = 120000; + +Res = sim('SimuGuns'); +echelle_freq = linspace(0,M-1,M)*(Fe/M); +r = fft(Res.Echanti.data); + +figure(1); +plot(Res.Continu); +grid; -%% Visualisations temporelle -plot(out.sin_continu,'.-'); hold on; -plot(out.sin_echanti,'o'); -grid on; +figure(2); -%% Calcul DFT +semilogy(echelle_freq,abs(r/M)); +grid; +%% +%Question 4 +clear all; +close all; +clc; -%% visualisation DFT -figure(); +Fe = 320000; +Te = 1/Fe; +T = 1/5000; +M = T/Te; +Tsim = T-Te; +F1 = 85005.9; +F2 = 90000; +F3 = 94846.8; +F4 = 100000; +F5 = 115015.9; +F6 = 120000; +Res = sim('SimuGuns'); +for i = 1:32 + Res.Echanti.data(i) = 0; +end +echelle_freq = linspace(0,M-1,M)*(Fe/M); +r = fft(Res.Echanti.data); + +figure(1); +plot(Res.Continu); +grid; + +hold on; +figure(2); +semilogy(echelle_freq,abs(r/M)); +grid; + +%% +%Question 6 +clear all; +close all; +clc; +F1 = 85000; +Fe = 320000; +Te = 1/Fe; +%T = 1/F1; +%M = T/Te; +T = 2*10^(-4); +M=2^6; +Tsim = T-Te; + +Res = sim('SimuGuns'); +echelle_freq = linspace(0,M-1,M)*(Fe/M); +r = fft(Res.carre1.data); + +figure(1); +plot(Res.carre1); +grid; + +hold on; +figure(2); +plot(echelle_freq,log10(abs(r/M)),'o'); +grid; +%% +% Question 8 +clear all; +close all; +clc; +F1 = 85000; +Fe = 320000; +Te = 1/Fe; +%T = 1/F1; +%M = T/Te; +T = 2*10^(-4); +M=2^6; +Tsim = T-Te; +p = tf('p'); +Fp = 1/(1.7483e-23*p^4 + 7.6663e-18*p^3 + 1.162e-11*p^2 + 3.0332e-6*p+1); + +Res = sim('SimuGuns'); +echelle_freq = linspace(0,M-1,M)*(Fe/M); +r = fft(Res.carre.data); + +figure(1); +plot(Res.carre); +grid; + +hold on; +figure(2); +bode(Fp); +plot(bode(Fp)); +%plot(echelle_freq,log10(abs(r/M)),'o'); +grid; diff --git a/signal/matlab/simDFT.slx b/signal/matlab/simDFT.slx deleted file mode 100644 index 5f5f7e4..0000000 Binary files a/signal/matlab/simDFT.slx and /dev/null differ