Incorrect continuous signal convolution values in Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to convolve the following signals in Matlab:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154494/image.png)
and
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154495/image.png)
for a=0.5. The result, say z(t) is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154496/image.png)
So here is my Matlab code:
%Define initial signals
alpha = .5;
Ts = 0.01;
t_x = -5:Ts:5;
x = heaviside(t_x);
t_y = -5:Ts:5;
y = heaviside(t_y).*(alpha.^abs(t_y));
%Plot initial signals
figure(1)
plot(t_x,x);
xlabel('t');
ylabel('x(t)');
axis([min(t_x)-1 max(t_x)+1 min(x)-1 max(x)+1]);
figure(2)
plot(t_y,y);
xlabel('t');
ylabel('y(t)');
axis([min(t_y)-1 max(t_y)+1 min(y)-1 max(y)+1]);
%Convolution
z = Ts*conv(x,y);
t_z = min(t_x)+min(t_y):Ts:max(t_x)+max(t_y);
figure(3)
plot(t_z,z);
xlabel('t');
ylabel('z(t)');
axis([min(t_z)-1 max(t_z)+1 min(z)-1 max(z)+1]);
The problem is that the final signal that Matlab calculates has incorrect values for values of t greater than 5. I have checked this in detail and noticed that the signal is wrong for t > max(t_x). Here is the final plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154497/image.png)
What am I doing wrong?
댓글 수: 0
채택된 답변
Star Strider
2016년 6월 27일
The convolution is actually defined only for your ‘t_x’ vector (that must be the same as ‘t_y’).
For example, if you have the Symbolic Math Toolbox, run this:
syms a t x y
assume(t>0)
assume(a>0)
x(t) = 1;
y(t) = a^t;
X = laplace(x);
Y = laplace(y);
Z = X*Y;
z = ilaplace(Z)
za = subs(z, a, 0.5);
figure(1)
fplot(za, [-5 5])
댓글 수: 6
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!