forked from acco/chti23
173 lines
2.2 KiB
Matlab
173 lines
2.2 KiB
Matlab
%%
|
|
%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;
|
|
|
|
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;
|
|
|
|
Res = sim('SimuGuns');
|
|
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
|
r = fft(Res.Echanti.data);
|
|
|
|
figure(1);
|
|
plot(Res.Continu);
|
|
grid;
|
|
|
|
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;
|
|
|
|
hold on;
|
|
figure(2);
|
|
|
|
semilogy(echelle_freq,abs(r/M));
|
|
grid;
|
|
|
|
%%
|
|
%Question 4
|
|
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');
|
|
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;
|