# how can I write the time function when I am plotting the convolution of two time continuous signals?

10 views (last 30 days)
mohamed alaa on 14 Dec 2016
Answered: Ahmet Cecen on 14 Dec 2016
% assume I have two signals to find and plot their convolution:
s=conv(x,h);
% t= ??
plot(t,s)
% I have error in length, "they should be the same length" is shown as error
David Barry on 14 Dec 2016
Well are they the same length?

Ahmet Cecen on 14 Dec 2016
This question shows a lack of fundamental understanding of convolution. Make sure to read up on what convolution/correlation is and work out a graphical example.
The output of a convolution has a natural origin, and the length of `s` represents time/space lags. So the center element of `s` will be t=0, or when both `x` and `h` are in sync. One element below the center will represent a lag of 1 units of t, or when there is a 1 unit delay between signals `x` and `h`.
Using the above information, you should be able to figure out what the length of the vector `s` means, and how to create a new `t` vector that corresponds to `s`.

### Categories

Find more on Correlation and Convolution in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by