如何在MATLAB中绘制卷积?

时间:2021-09-05 04:17:21

So I have a unit step function U(t)-U(t-1) and another function e^(-4t) *U(t). These functions are defined as vectors and vary from t_start to t_end. Now when I take the convolution of this function the resultant vector is almost twice the length of the time vector and hence I cannot use plot function to plot the convolved waveform. Any idea how to match the time axis and the convolution result so they can be plotted ? Thanks.

所以我有一个单位阶跃函数U(t)-U(t-1)和另一个函数e ^( - 4t)* U(t)。这些函数被定义为向量,从t_start到t_end不等。现在,当我对该函数进行卷积时,合成矢量几乎是时间矢量长度的两倍,因此我无法使用绘图函数绘制卷积波形。知道如何匹配时间轴和卷积结果,以便绘制它们吗?谢谢。

1 个解决方案

#1


1  

Use the 'same' argument to the conv function to get the same length out as you put in. Just make sure you give the arguments in the correct order.

使用conv函数的'same'参数可以获得与输入相同的长度。只需确保以正确的顺序给出参数。

#1


1  

Use the 'same' argument to the conv function to get the same length out as you put in. Just make sure you give the arguments in the correct order.

使用conv函数的'same'参数可以获得与输入相同的长度。只需确保以正确的顺序给出参数。