TP matlab

This commit is contained in:
Boyu Fu 2023-03-24 16:00:35 +01:00
parent 57163ca9ee
commit 951b575884
7 changed files with 88 additions and 26 deletions

Binary file not shown.

33
signal/matlab/L32.m Normal file
View file

@ -0,0 +1,33 @@
clc;
clear all;
close all;
F1 = 85005.9;
F2= 90000;
F3 = 94986.8;
F4 = 100000;
F5 = 115015.9;
F6 = 120000;
Fe = 320000;
F = 5000;
Te = 1/Fe;
T = 1/F ;
M = T/Te;
Tsim = T-Te;
Res = sim('LG');
plot(Res.Sinus_Continu);
hold on;
plot(Res.Sinus_Echanti,'o');
%figure
f = fft(Res.Sinus_Echanti.data, M)/M;
%stem(linspace(0, M-1, M), abs(f),'o');
figure
stem(linspace(0, M-1, M) / (M*Te), abs(f),'o');
figure
bode(tf(1,[1.7483E-23 7.6663E-18 1.162E-11 3.0332E-6 1]))

BIN
signal/matlab/LG.slx Normal file

Binary file not shown.

BIN
signal/matlab/SimulDFT.slx Normal file

Binary file not shown.

BIN
signal/matlab/carre.slx Normal file

Binary file not shown.

27
signal/matlab/carre32.m Normal file
View file

@ -0,0 +1,27 @@
clc;
clear all;
close all;
F1 = 85000;
Fe = 320000;
F = 5000;
Te = 1/Fe;
T = 1/F ;
M = T/Te;
Tsim = T-Te;
Res = sim('carre');
plot(Res.Carre_Continu,'b');
hold on;
plot(Res.Signal_Filtre,'o');
%figure
f = fft(Res.Signal_Filtre.data, M);
%stem(linspace(0, M-1, M), abs(f),'o');
figure
stem(linspace(0, M-1, M) / (M*Te), abs(f),'o');
figure
bode(tf(1,[1.7483E-23 7.6663E-18 1.162E-11 3.0332E-6 1]))

View file

@ -1,31 +1,33 @@
clc;
clear all;
close all;
%% Paramètres
T = 0.25; % Fenêtre d'observation
M=32; % Nombre d'échantillons dans la fenêtre
%% Paramètres déduits
Te = T/M; % Période d'échantillonnage
Tsim = T-Te; % Instant final de simulation
Fsin = 4 ;
%% Calculs préliminaires
%% Lancement de simulink
out=sim("simDFT")
%% Visualisations temporelle
plot(out.sin_continu,'.-');
hold on;
plot(out.sin_echanti,'o');
grid on;
%% Calcul DFT
%% visualisation DFT
figure();
T = 1/5000;
M = 64;
Te = T/M;
Tsim = T-Te;
Fe = 1/Te;
%%Fsin = 4;
%%Fsin = 60;
%%Fsin = 64; shannon < Fe/2
%%Fsin = 100;
Fsin=85000;
Res = sim('SimulDFT');
plot(Res.Sinus_Continu);
hold on; % permet de superposer la courbe à suivre
plot(Res.Sinus_Echanti,'o');
%figure
f = fft(Res.Sinus_Echanti.data, M)/M;
%stem(linspace(0, M-1, M), abs(f),'o');
figure
stem(linspace(0, M-1, M) / (M*Te), abs(f),'o');
%%figure
%%plot(linspace(0, M-1, M) / (M*Te/100), abs(fft(Res.Sinus_Continu.data, M)/M));
%%hold on;
%%plot(linspace(0, M-1, M) / (M*Te), abs(fft(Res.Sinus_Echanti.data, M)/M),'o');