How to plot convolution of 2 functions

if i have a y1 function of t , and y2 function of t and i want to plot convolution of y1 and y2 with time, how to do that it gives me length error

3 comentarios

madhan ravi
madhan ravi el 20 de Dic. de 2018
share your code
t=0:0.1:10;
y1=3*t+5;
y2=4*t.^2+1;
output=conv(y1,y2);
plot (t,output)
vishal raj
vishal raj el 20 de Nov. de 2019
plot(output)

Iniciar sesión para comentar.

 Respuesta aceptada

madhan ravi
madhan ravi el 20 de Dic. de 2018
Editada: madhan ravi el 20 de Dic. de 2018
syms t
y1=3*t+5;
y2=4*t^2+1;
fplot(y1*y2)
%edit after Brunos suggestion it’s not possible to represent the convolution for these functions

6 comentarios

Mohamed H
Mohamed H el 20 de Dic. de 2018
Yess it worked, Thank youu
madhan ravi
madhan ravi el 20 de Dic. de 2018
Anytime :)
Bruno Luong
Bruno Luong el 20 de Dic. de 2018
Editada: Bruno Luong el 20 de Dic. de 2018
Careful, the solution provided by ravi is discrete convolution.
Your functions actually doesn't have finite (continuous) convolution, they are not integrable on any standard function space.
You change the t vector (length/step) you'll see the values of the discrete convolution is not stable.
So what is the result? I think it's mostly garbage.
madhan ravi
madhan ravi el 20 de Dic. de 2018
yes completely agree with Bruno , so how can it be plotted?
Bruno Luong
Bruno Luong el 20 de Dic. de 2018
It cannot be plotted. The convolution is not defined for those functions.
madhan ravi
madhan ravi el 20 de Dic. de 2018
Thanks Bruno for making it loud and clear.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 20 de Dic. de 2018

Comentada:

el 20 de Nov. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by