traitement de la partie signal

This commit is contained in:
Nathan Billard 2023-02-10 14:41:48 +01:00
parent c64609438d
commit c157d72f79
8 changed files with 125 additions and 11 deletions

View file

@ -0,0 +1,76 @@
clc;
clear all;
close all;
%F1 = 85000;
F1 = 85005.9;
F2 = 90000;
%F3 = 95000;
F3 = 94986.8;
F4 = 100000;
%F5 = 115000;
F5 = 115015.9;
F6 = 120000;
ChebFac0 = 1;
ChebFac1 = 3.0332e-6;
ChebFac2 = 1.162e-11;
ChebFac3 = 7.6663e-18;
ChebFac4 = 1.7483e-23;
Fe=320000;
Te = 1/Fe;
Fsin=120000;
N=6;
M=pow2(N);
T=M*Te;
% Condition : T < M/(2*Fsin)
%T = pow2(N-2)/Fsin;
%Te = T/M;
Tsim = T-Te;
res=sim('Simul6PistoletsDFT.slx');
%plot(res.Echant.Data);
F=linspace(0, Fe-Fe/M, M);
% mauvais_echantillon = res.Echant.Data;
% for i = 1:floor((length(mauvais_echantillon) / 2))
% mauvais_echantillon(i) = 0;
% end
% fourier = abs(fft(mauvais_echantillon)/M);
filteredSignal = arrayfun(@(x) chebychev(x), res.Echant.Data);
fourier = abs(fft(filteredSignal)/M);
% fourier=abs(fft(res.Echant.Data)/M);
%res=sim('SimulDFT.slx');
%fourier=fft(res.Sinus_Echantillon.Data)/M;
%fourier = real(fourier * (1i));
% bode(tf(F,arrayfun(@(x) chebychev(x), F)));
%
grid;
stem(F, fourier, 'o');
set(gca, 'YScale', 'log');
%plot(res.Sinus_Continu);
%hold on; % permet de superposer la courbe à suivre
%plot(res.Sinus_Echantillon,'o');
function filtre = chebychev(p)
ChebFac0 = 1;
ChebFac1 = 3.0332e-6;
ChebFac2 = 1.162e-11;
ChebFac3 = 7.6663e-18;
ChebFac4 = 1.7483e-23;
filtre = 1 / (ChebFac4 * p^4 + ChebFac3 * p^3 + ChebFac2 * p^2 + ChebFac1 * p + ChebFac0);
end

View file

@ -3,12 +3,21 @@ clear all;
close all;
F1 = 85000;
% F1 = 85005.9;
F2 = 90000;
F3 = 95000;
%F3 = 95000;
F3 = 94986.8;
F4 = 100000;
F5 = 115000;
%F5 = 115000;
F5 = 115015.9;
F6 = 120000;
ChebFac0 = 1;
ChebFac1 = 3.0332e-6;
ChebFac2 = 1.162e-11;
ChebFac3 = 7.6663e-18;
ChebFac4 = 1.7483e-23;
Fe=320000;
Te = 1/Fe;
@ -21,20 +30,49 @@ T=M*Te;
%T = pow2(N-2)/Fsin;
%Te = T/M;
% harmoniques = arrayfun(@(x) x * 2 * pi * F1, 0:1:5);
% reponseHarmoniques = arrayfun(@(x) chebychev(x), harmoniques);
% loglog(harmoniques, reponseHarmoniques);
Tsim = T-Te;
res=sim('Simul6PistoletsDFT.slx');
%plot(res.Echant.Data);
F=linspace(0, Fe-Fe/M, M);
fourier=fft(res.Echant.Data)/M;
% mauvais_echantillon = res.Echant.Data;
% for i = 1:floor((length(mauvais_echantillon) / 2))
% mauvais_echantillon(i) = 0;
% end
% fourier = abs(fft(mauvais_echantillon)/M);
% filteredSignal = arrayfun(@(x) chebychev(x), res.Echant.Data);
% fourier = abs(fft(filteredSignal)/M);
fourier=abs(fft(res.Echant.Data)/M);
%res=sim('SimulDFT.slx');
%fourier=fft(res.Sinus_Echantillon.Data)/M;
%fourier = real(fourier * (1i));
% bode(tf(F,arrayfun(@(x) chebychev(x), F)));
grid;
stem(F, abs(fourier), 'o');
%plot(res.Sinus_Continu);
% grid;
% stem(F, fourier, 'o');
% set(gca, 'YScale', 'log');
plot(res.Echant);
%plot(res.Sinus_Continu);
%hold on; % permet de superposer la courbe à suivre
%plot(res.Sinus_Echantillon,'o');
% plot(res.Sinus_Echantillon,'o');
function filtre = chebychev(p)
ChebFac0 = 1;
ChebFac1 = 3.0332e-6;
ChebFac2 = 1.162e-11;
ChebFac3 = 7.6663e-18;
ChebFac4 = 1.7483e-23;
filtre = 1 / (ChebFac4 * p^4 + ChebFac3 * p^3 + ChebFac2 * p^2 + ChebFac1 * p + ChebFac0);
end

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<MF0 version="1.1" packageUris="http://schema.mathworks.com/mf0/SlCache/19700101">
<slcache.FileAttributes type="slcache.FileAttributes" uuid="a5a0bbf3-a847-4a2b-9d82-9ebba8ce1642">
<checksum>rxgpOFrmDq+h/7MggWfCkg==</checksum>
<slcache.FileAttributes type="slcache.FileAttributes" uuid="ff96ea0b-c4c1-4804-8a4c-c2928fa73624">
<checksum>pmTiLxkS7fwMuApKXllVww==</checksum>
</slcache.FileAttributes>
</MF0>