2.2.4 Multiple Data Sets in One Plot

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

2.2.

4 Multiple data sets in one plot


Multiple (x, y) pairs arguments create multiple graphs with a single call to plot. For
example, these statements plot three related functions of x: y1 = 2 cos(x), y2 =
cos(x), and y3 = 0.5 ∗ cos(x), in the interval 0 ≤ x ≤ 2π.
Typical example of multiple plots
3
clc 2*cos(x)
cos(x)
2 0.5*cos(x)
x = 0:pi/100:2*pi;
y1 = 2*cos(x); 1
y2 = cos(x);

Cosine functions
y3 = 0.5*cos(x); 0
plot(x,y1,'--',x,y2,'-',x,y3,':')
xlabel('0 \leq x \leq 2\pi') -1
ylabel('Cosine functions')
legend('2*cos(x)','cos(x)','0.5*cos(x)') -2
title('Typical example of multiple plots')
axis([0 2*pi -3 3]) -3
0 1 2 3 4 5 6
0  x  2
ÉCHANTILLONNÉE

Signal Discret ou Echantillonné


0.6

clc 0.5

echo on 0.4
t=0:.2:5; exp(-t)*sint(2*t),T=.2 seconde

signal échantillonné
stem(t,exp(- 0.3

t).*sin(2*t),'fill'); 0.2
xlabel('temps en seconde')
ylabel('signal échantillonné') 0.1

title('Signal Discret ou 0
Echantillonné')
gtext('exp(-t)*sint(2*t),T=.2 -0.1

seconde') -0.2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
grid temps en seconde
Signal Bloqué
0.6
t=0:.2:5;
stairs(t,exp(-t).*sin(2*t)); 0.5

xlabel('t=0:.2:5 (temps en 0.4


seconde)','FontSize',14)

Signal Bloqué
ylabel('Signal 0.3

Bloqué','FontSize',14) 0.2
title('Signal Bloqué',
'FontSize',18) 0.1

text(1,2.5,'e^{- 0
\alpha*t}*sint\beta*t, T = .2
seconde') -0.1

grid -0.2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t=0:.2:5 (temps en seconde)
Signal Analogique, Signal Numérique
t=0:.2:5; 0.6

f= exp(-t).*sin(2*t); 0.5
hold on
stem(t,0.1*fix(f/.1),'fill'); 0.4 Quantification d'amplitude: 0.1
stairs(t,f); 0.3
xlabel('temps (en
seconde)','FontSize',14) 0.2

title('Signal Analogique, Signal0.1


Numérique', 'FontSize',18)
text(1.5,.4,'Quantification 0

d''amplitude: 0.1', -0.1


'FontSize',16)
grid -0.2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
temps (en seconde)
%1 génération impultion unité 1
impultion unité

%impultion unité
0.9
clear all ;
clc 0.8

close all 0.7

n=-10:10; 0.6

amplitud
x=[zeros(1,10),1,zeros(1,10)]; 0.5
figure(1);
0.4
stem(n,x);
0.3
title('impultion unité');
grid on 0.2

xlabel('n'); 0.1

ylabel('amplitud') 0
-10 -8 -6 -4 -2 0 2 4 6 8 10
n
clear all 1.5
Echelon unité

clc
close all
%2 génération impultion unité 1
%Echelon unité
n=-10:10;
x=[zeros(1,10),ones(1,11)];

amplitud
0.5
figure(2);
stem(n,x);
grid on 0
axis([-15 15 -.5 1.5]);
title('Echelon unité');
xlabel('n'); -0.5
ylabel('amplitud') -15 -10 -5 0
n
5 10 15
sinus
% 3A sinus 1.5

clear all; clc ;close all


1
n=-10:10;
x=(0.35*n);
0.5
figure(3);
stem(n,x);

amplitude
0
grid on
axis([-15 15 -1.5 1.5]);
-0.5
title('sinus');
xlabel('n');
-1
ylabel('amplitude')
-1.5
-15 -10 -5 0 5 10 15
n
exponentielle retardée
clear all ; 1.5

clc
close all 1

% 3B exponentiel
n=-10:10; 0.5

u=[zeros(1,10),ones(1,11)];

amplitud
x=exp(-0.2*n).*u; 0

figure(4);
stem(n,x); -0.5

grid on
axis([-10 10 -1.5 1.5]); -1

title('exponentielle retardée');
xlabel('n'); -1.5
-10 -8 -6 -4 -2 0 2 4 6 8 10
ylabel('amplitud') n

You might also like