miércoles, 29 de junio de 2016

Convolución de dos señales en Matlab

La convolución continua de dos funciones esta dada por:
De esta forma, lo que esperaríamos ver al convolucionar dos pulsos cuadrados de amplitud y ancho unitario se muestra en la siguiente animación:

 Para implementar la convolución de dos señales en Matlab se debe considerar que la función conv() [ver documentación] está realizando la operación de convolución discreta que está expresada como:
Si uno utiliza esta función esperando los resultados de una convolución continua, se lleva la sorpresa de que los valores de la convolución resultante son muchos más altos que los valores correctos. Esto se ocurre porque hace falta considerar que una convolución continua se aproxima como el producto del periodo de muestreo por la convolución discreta de las mismas señales evaluadas en tiempo discreto. Esto es:
Así, el programa en Matlab nos queda:

Ts = 0.01;
t = -2:Ts:2;
f = (t>-0.5) - (t>0.5);
g = f;

%Convolución
cnv = Ts*conv(f,g,'same');

subplot(3,1,1),plot(t,f), ylim([0 1.5]),title('f(t)'),grid on
subplot(3,1,2),plot(t,g,'r'), ylim([0 1.5]),title('g(t)'),grid on
subplot(3,1,3),plot(t,cnv,'g'), ylim([0 1.5]),title('conv(f(t),g(t))'),grid on

Referencias:
Using MATLAB with the Convolution Method, California State University Northridge

miércoles, 1 de junio de 2016

Language Barriers

I hadn't written in English here before. Now, regarding that I need to take the GRE this year, it's something that I enormously regret. Mostly what I post here are technical notes of problems I solved and that there is no documentation online about it in Spanish. Someone commented once that I should write my technical notes in English so people all over the world can use them. What I always say is that there's plenty of resources written in English while good ones written in Spanish are scarce. That's why I prefer to write in my mother language. I feel I'm contributing to the develop of my region, not only Mexico but all the Hispanic world. But this blog is not only about engineering and science stuff (things I really passionate about), although it seems to be the case. It's about my life too, the whole of it. I think writing about ourself and our lives is not narcissism. We need to know other peoples thoughts and passions in order to make a better view of the world. So I know that writing always in Spanish have trapped me in bubble too. I haven't done blogger friends outside Hispanic America. But the blogosphere is kind of dead these day anyway, isn't it? Or may be it's just in the Spanish Internet! I don't even know it for the same reason. Well, I'll give it shot.