Está en la página 1de 3

PRACTICA 4 : OPERA CI ONES Y SI STEMA S EN TIEMPO DISCRETO

OBJETIVOS

1. Realizar funciones para realizar operaciones en tiempo discreto usando MATLAB
2. Comprobar la funcin convolucion.

EXPERIMENTO

Genere un archivo .m nuevo. Escriba cada instruccin y ejectela para ver su
funcionamiento. Al terminar la prctica podr ejecutar todas las instrucciones y
mostrar los resultados.
Se le sugiere separe zonas de ejecucin usando la instruccin pause.

1.- Suma de seales

Crear la funcin:
function [y,n]=sigadd(x1,n1,x2,n2)
% implements y(n)=x1(n)+x2(n)
% x1 and x2 are signal, n1 and n2 are index
n=min(min(n1),min(n2)):max(max(n1),max(n2)); % duration of y(n)
y1=zeros(1,length(n));y2=y1; % initialization
y1(find((n>=min(n1))&(n<=max(n1))==1))=x1; % x1 with duration of y
y2(find((n>=min(n2))&(n<=max(n2))==1))=x2; % x2 with duration of y
y=y1+y2;

>> n1=-2:2; x1=[1 2 3 4 5 ]; n2=-1:4; x2=[1 2 3 4 5 6]; [ y,n]=sigadd(x1,n1,x2,n2);
>>stem(n,y); %Grafica

2.- Producto de seales

Crear la funcin:
function [y,n]=sigmult(x1,n1,x2,n2)
% implements y(n) =x1(n)*x2(n)
%
n=min(min(n1),min(n2)):max(max(n1),max(n2)); % duration of y(n)
y1 =zeros(1,length(n)); y2 =y1; %
y1(find((n>=min(n1))&(n<=max(n1))==1))=x1; % x1 with duration of y
y2(find((n>=min(n2))&(n<=max(n2))==1))=x2; % x2 with duration of y
y =y1 .* y2;

>> n1=-2:2; x1=[1 2 3 4 5 ]; n2=-1:4; x2=[1 2 3 4 5 6]; [ y,n]=sigmult(x1,n1,x2,n2);
>>stem(n,y); %Grafica

3.- Escalamiento o multiplicacin por una constante

>>x=[1 2 3]; y=3*x;

4.- Desplazamiento

Crear la funcin:
function [y,n] =sigshift(x,m,n0)
% implements y(n) =x(n-n0) m: index of x, n: index of y
n =m+n0; y =x;
>> m=[-2 1 0 1 2 3]; x=[0 1 2 3 4 5]; [y,n]=sigshift(x,m,3);
>>stem(n,y); %Grafica

5.- Reflexin

Crear la funcin:
function [y,n] =sigfold(x,n)
% implements y(n) =x(-n)
y =fliplr(x); n =-fliplr(n);

>> m=[-2 1 0 1 2 3]; x=[0 1 2 3 4 5]; [y,n]=sigfold(x,m);
>>stem(n,y); %Grafica

6.- Convolucin:
>>x=[1 1 1 1 0 0]
>>h=[6 5 4 3 2 1]
>>y=conv(x,h)
Pero no podemos identificar donde comienza la secuencia entonces debemos crear la
funcin:




Ejercicio 1.- Con x(n) = . Determine y grafique las
siguientes secuencias:
a. x
1
(n) =2x(n - 5) - 3x (n +4)
b. x
2
(n) =x (3 - n) +x (n) x (n - 2)


Ejercicio 2.- Calcule y grafique la convolucion para las seales:


,

También podría gustarte