-
Notifications
You must be signed in to change notification settings - Fork 0
/
Schéma2.m
129 lines (112 loc) · 4.22 KB
/
Schéma2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
pkg load control ;
pkg load specfun ;
clear all ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% some functions :
function Y = dirac_function(X)
%DIRAC Delta function.
% DIRAC(X) is zero for all X, except X == 0 where it is infinite.
% more comments
Y = zeros(size(X));
Y(X == 0) = 1;
endfunction;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure('Name','Schéma N° 02','NumberTitle','off');% the window title
sys = tf([0 1],[1 70]); % Transfer function of an RC circuit with L/R = 1 ms
t = -2:0.001:10;
ht = exp(-t).*(t>=0); % System impulse response
%ht = impulse(sys, t); % System impulse response
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1: le signal indicielle (échelon unité)
subplot(5,2,1);
unitstep = t>=0; % the Step function // échelon unité
plot(t,unitstep);
title('La représentation graphique du signal indicielle');
%sgtitle('Subplot Grid Title')
ylabel('x(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2: La réponse indicielle (échelon unité)
subplot(5,2,2);
y = lsim(sys,unitstep,t); % Simulate the output of the system
plot(t,ht,'g',t,y,'r');
legend('h(t) : La réponse impulsionnelle','y(t): La sortie du système');
title('La réponse indicielle');
ylabel('y(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3: Le Dirac
subplot(5,2,3);
plot(t,dirac_function(t));
title('La représentation graphique du Dirac');
ylabel('x(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4: La réponse au Dirac
subplot(5,2,4);
z = (t>0 & t<0.1)/0.1;
y = lsim(sys,z,t); % Simulate the output of the system
plot(t,ht,'g',t,y,'r');
legend('h(t) : La réponse impulsionnelle','y(t): La sortie du système');
title('La réponse au Dirac');
ylabel('y(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 5: le signal rampe
subplot(5,2,5);
ramp = t.*unitstep; % the Ramp function
plot(t,ramp)
title('La représentation graphique du signal rampe');
ylabel('x(t)');
box off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 6: La réponse à une rampe
subplot(5,2,6);
y = lsim(sys,ramp,t); % Simulate the output of the system
plot(t,ht,'g',t,y,'r');
legend('h(t) : La réponse impulsionnelle','y(t): La sortie du système');
title('La réponse à une rampe');
ylabel('y(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 7: le signal parabole
subplot(5,2,7);
quad = t.^2.*unitstep;% the Quad function (le signal parabole)
plot(t,quad);
title('La représentation graphique du parabole');
ylabel('x(t)');
box off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 8: La réponse à une parabole
subplot(5,2,8);
y = lsim(sys,quad,t); % Simulate the output of the system
plot(t,ht,'g',t,y,'r');
legend('h(t) : La réponse impulsionnelle','y(t): La sortie du système');
title('La réponse à une parabole');
ylabel('y(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 9: le signal sinusoidal
subplot(5,2,9);
sinus = sin(t).*(t>=0);% la fonction sin(x)
plot(t,sinus);
title('La représentation graphique du signal sinusoidal');
ylabel('x(t)');
box off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 10: La réponse à une sinusoide
subplot(5,2,10);
y = lsim(sys,sinus,t); % Simulate the output of the system
plot(t,ht,'g',t,y,'r');
legend('h(t) : La réponse impulsionnelle','y(t): La sortie du système');
title('La réponse à une sinusoide');
ylabel('y(t)');
box off;
xlim([min(t) max(t)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%