0% found this document useful (0 votes)
18 views11 pages

CONVOLUCION

Uploaded by

Eddy Morillo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views11 pages

CONVOLUCION

Uploaded by

Eddy Morillo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

%% Eddy Morillo

%% Limpiar
clc;
close all;
clear all;

%% inicializar variables:
fs = 150;
t = linspace(-8,8,fs);
ax = [-8 8 -1 8];
ax_tau = [-10 10 -1 8];
ax_conv = [-10 12 -1 30];

%% señales h(t) y x(t):


h = t.*(t>= 0 & t<=7);
x = 1.*(t>= -7 & t<=9);

figure(1)
plot(t,h,'Color','blue','LineWidth',2),axis(ax);
grid on;
xlabel('\tau','FontSize', 16)
ylabel('h(\tau)','FontSize', 16)

% x=fliplr(x); %invierte la señal: x(-t)% no se uso


realmente
figure(2)
plot(t,x,'Color','red','LineWidth',2),axis(ax);
grid on;
xlabel('\tau','FontSize', 16)
ylabel('x(\tau)','FontSize', 16)

disp('Presiona una tecla ...');


pause;

%% Cambio de t a Tau para convolucion:


tau = linspace(min(t)*2, max(t)*2,length(h) + length(x)+
1);
h_tau = tau.*(tau>= 3 & tau<=4);
x_tau = 1.*(tau>= -3 & tau<=3);
iter = length(zeros(1,length(h) + length(x)+ 1));
convolution = zeros(1,length(h) + length(x)+ 1);

%% Convolucion a pasos de x con h:


figure(3)
for i = 1:iter
mov = min(tau) + (i*(tau(2) - tau(1))); %(10*i-
fs)/fs;
h_modif = (mov-tau).*((mov-tau)>= 0 & (mov-tau)<=7);
convolution(i) = trapz(tau, x_tau.*h_modif);%Hace
integral de funciones

subplot(2,2,1:2)
hold off;

plot(tau,x_tau,'Color','red','LineWidth',2),axis(ax_tau)
;
hold on;

plot(tau,h_modif,'Color','blue' ,'LineWidth',2),axis(ax_
tau);
grid on;
xlabel('\tau', 'FontSize', 16);
ylabel('h(t - \tau)', 'FontSize', 16);

subplot(2,2,3:4)
hold off

plot(tau(1:i),convolution(1:i),'Color','black','LineWidt
h',2),axis(ax_conv);
grid on;
xlabel('\tau', 'FontSize', 16);
ylabel('\int x(\tau)h(t - \tau)d\tau', 'FontSize',
16);

pause(0.01)
end
%% Convolucion:
figure(4)
plot(tau,convolution,'Color','black','LineWidth',2),axis
(ax_conv);
grid on;
xlabel('t', 'FontSize', 16);
ylabel('h(t) * x(t)', 'FontSize', 16);

%% Titulos de frames:
figure(1)
title('Señal o Función h(\tau) ');
figure(2)
title('Señal o Función x(\tau) ');
figure(4)
title('Convolución ');

You might also like