forked from acco/chti23
ajout des fichiers matlab
This commit is contained in:
parent
d2647bf70b
commit
01dee3307d
4 changed files with 159 additions and 17 deletions
BIN
signal/matlab/SimuGuns.slx
Normal file
BIN
signal/matlab/SimuGuns.slx
Normal file
Binary file not shown.
BIN
signal/matlab/SimulDFT.slx
Normal file
BIN
signal/matlab/SimulDFT.slx
Normal file
Binary file not shown.
|
@ -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;
|
clear all;
|
||||||
close all;
|
close all;
|
||||||
|
clc;
|
||||||
|
|
||||||
%% Paramètres
|
Fe = 320000;
|
||||||
T = 0.25; % Fenêtre d'observation
|
Te = 1/Fe;
|
||||||
M=32; % Nombre d'échantillons dans la fenêtre
|
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
|
Res = sim('SimuGuns');
|
||||||
Te = T/M; % Période d'échantillonnage
|
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
||||||
Tsim = T-Te; % Instant final de simulation
|
r = fft(Res.Echanti.data);
|
||||||
Fsin = 4 ;
|
|
||||||
%% Calculs préliminaires
|
|
||||||
|
|
||||||
|
figure(1);
|
||||||
|
plot(Res.Continu);
|
||||||
|
grid;
|
||||||
|
|
||||||
%% Lancement de simulink
|
figure(2);
|
||||||
out=sim("simDFT")
|
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;
|
hold on;
|
||||||
plot(out.sin_echanti,'o');
|
figure(2);
|
||||||
grid on;
|
|
||||||
|
|
||||||
%% Calcul DFT
|
semilogy(echelle_freq,abs(r/M));
|
||||||
|
grid;
|
||||||
|
|
||||||
|
%%
|
||||||
|
%Question 4
|
||||||
|
clear all;
|
||||||
|
close all;
|
||||||
|
clc;
|
||||||
|
|
||||||
%% visualisation DFT
|
Fe = 320000;
|
||||||
figure();
|
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;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue