From b9b8b7618b291a6cb9a26ca84b7fc0bc7fe06305 Mon Sep 17 00:00:00 2001 From: joemus <joemus@utu.fi> Date: Thu, 8 Feb 2024 19:01:15 +0200 Subject: [PATCH] =?UTF-8?q?pieni=C3=A4=20muokkauksia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mustonen_Exec2_T2.m | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Mustonen_Exec2_T2.m b/Mustonen_Exec2_T2.m index c732e6e..7982fa6 100644 --- a/Mustonen_Exec2_T2.m +++ b/Mustonen_Exec2_T2.m @@ -1,6 +1,22 @@ -bk = [0,0,2,0,-1,0,2]; -x= @(n) -7*(n-3); -y = conv(bk, x); +% FIR filter coefficients +bk = [0, 0, 2, 0, -1, 0, 2]; -figure; -stem(x); \ No newline at end of file +% Input signal +n = 0:10; +x = 7 * (n - 3 == 0); + +% Convolution to calculate output +output = conv(x, bk); + +% Plotting +subplot(2,1,1); +stem(n, x); +title('Input Signal'); +xlabel('Sample'); +ylabel('Amplitude'); + +subplot(2,1,2); +stem(output); +title('Output Signal'); +xlabel('Sample'); +ylabel('Amplitude'); \ No newline at end of file -- GitLab