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;
|
||||
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;
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue