How can I Implement a convolution function in MATLAB and perform it on the following signals and plot the results ?
이전 댓글 표시
Hi guys,
I have the following function:
impulse_response = zeros(1, length(input) + length(delta) - 1 );
for t_samp = 1:length(input)
for c_samp = 1:length(delta)
index = t_samp + c_samp - 1;
value = delta(c_samp) * input(t_samp);
impulse_response(index) = impulse_response(index) + value;
end
end
I am new to Matlab and I want to understand how to Implement a convolution function in MATLAB and perform it on the following signals and plot the results ?
Task (1):
x[n] = [1,1,1,1] h[m] = [1,0,−1] x[n] = sin(n) h[m] = [−1,−2,8,−2,−1] 20 ≤ n < 20
Task (2): Given the input signal x[n]=0.3∗sin(n/5)+sin(n/50) : -Create your own delta signal h[m] that removes the higher frequency sinusoidal component to get yl[n].
Thanks in advance for your kind explanation.
댓글 수: 2
Walter Roberson
2018년 3월 14일
Could you confirm that your n values are radians and not degrees?
Vaban Dust
2018년 3월 15일
채택된 답변
추가 답변 (3개)
Abhishek Ballaney
2018년 3월 15일
편집: Walter Roberson
2020년 10월 20일
1 개 추천
Ankur Agrawal
2021년 9월 21일
편집: Walter Roberson
2021년 12월 29일
n = -20:20;
x = sin(n);
h = [-1,-2,8,-2,-1];
N = length(x);
M = length(h);
Ny = N + M -1;
y = zeros(1,Ny);
for i = 1:N
for k = 1:M
y(i+k-1) = y(i+k-1) + h(k)*x(i);
end
end
m = 0: Ny-1;
Abdullah Mohmmed
2021년 12월 29일
0 개 추천
Write a MATLAB code to calculate and plot the two-sided convolution between the two discrete time signals x(n) and h(n) shown below
댓글 수: 1
Walter Roberson
2021년 12월 29일
No signal definitions were shown.
And if they had been, we would have just referred you to the discussion above, which includes full code.
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

