convolution without conv function

5 visualizaciones (últimos 30 días)
찬경
찬경 el 9 de Abr. de 2023
Respondida: Image Analyst el 9 de Abr. de 2023
I want to convolution of two continuous signals without using conv.
so i code
k= -10 : 0.01 : 10;
t= -10 : 0.01 : 10;
h= @(k,t) (k>=1);
x= @(k,t)(k>=-1).*(k<=1);
y1= int(x(k).*h(-k+t),k,-10,10);
y2= int(h(k).*x(-k+t),k,-10,10);
subplot(4,1,1);plot(k,x(k));
subplot(4,1,2);plot(k,y(k));
subplot(4,1,3);plot(t,y1);
subplot(4,1,4);plot(t,y2);
but there is problem y1 and y2
integral error.
how to integral that?
𝑥(𝑡) = 𝑟𝑒𝑐𝑡 ( 𝑡/ 2 ) , ℎ(𝑡) = 𝑢(𝑡 − 1)
y(t) = integral this x(r)h(t -r )dr (form -10 to 10)
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 9 de Abr. de 2023
int is used for symbolic integration.
You have defined "t" and "k" as the independent variables, but you have only used "k" in the definition, so any value of "t" will not have any effect on the outcome.
찬경
찬경 el 9 de Abr. de 2023
It is understood that if the two variable expressions are positively integrated for one variable, the equation of the remaining variable becomes. I don't know how to code this kind of situation like this. Originally, the expression is one variable, but I am thinking of adding one variable only when integrating.

Iniciar sesión para comentar.

Respuestas (3)

Paul
Paul el 9 de Abr. de 2023
Editada: Paul el 9 de Abr. de 2023
Questions like this are fairly common on this forum. A closed form expression can be obtained using
Here is a similar Question with answer that may be of interest to adapt to this problem.

Matt J
Matt J el 9 de Abr. de 2023
syms z k t real
h(z)= piecewise(z>=1,1,0);
x(z)= piecewise(abs(z)<=1,1,0);
y1= int(x(k).*h(t-k),k,-10,10)
Warning: Unable to check whether the integrand exists everywhere on the integration interval.
y1 = 
y2= int(h(k).*x(t-k),k,-10,10)
Warning: Unable to check whether the integrand exists everywhere on the integration interval.
y2 = 
  1 comentario
Paul
Paul el 9 de Abr. de 2023
Despite the statement in the question, I suspect that the problem is to find the convolution of x(t) and h(t) for -10 <= t <= 10. But that's not the same as integrating over that interval. That interval works fine for y1 because it covers the entire interval where x(t) ~= 0, but not for y2, which is why y1 and y2 are not the same.
I guess more clarity on the question is needed.

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 9 de Abr. de 2023
Attached is a "manual" way to do convolution. It will be straightforward to adapt it from 2-D images to 1-D vectors if you want.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by