signal processing - plot convolution in the time domain with octave -
this plots result of conv vector of new length , t
usless include in plot plot(t, z1) %doesn't work!
.
t = [-5:.1:10]; unit = @(t) 1.*(t>=0); h1 = @(t) (3*t + 2).*exp(-3*t).*unit(t); z1 = conv(unit(t), h1(t)); plot(z1);
i want plot of convolved signal function of time.
you need add shape argument. here's spec:
— function file: conv (a, b) — function file: conv (a, b, shape) convolve 2 vectors , b.
the output convolution vector length equal length (a) + length (b) - 1. when , b coefficient vectors of 2 polynomials, convolution represents coefficient vector of product polynomial.
the optional shape argument may be
shape = "full" return full convolution. (default) shape = "same" return central part of convolution same size a.
so convolve this:
z1 = conv(unit(t), h1(t), "same");
and you'll same time units original.