create a new mfile to make it plot raw vs filtered

This commit is contained in:
Tikea TE 2025-04-16 15:29:45 +02:00
parent b5b044a6e4
commit a56c7d75cd
1 changed files with 32 additions and 0 deletions

32
plotRawVsFiltered.m Normal file
View File

@ -0,0 +1,32 @@
function plotRawVsFiltered(rawSignal, filteredSignal, Fs)
%{
function plotRawVsFiltered(rawSignal, filteredSignal, Fs)
Ex: plotRawVsFiltered(X, x_filtered, 200)
Task:
Plot both the original (raw) signal and the filtered signal
on the same figure to compare them.
Inputs:
- rawSignal: the original signal before filtering
- filteredSignal: the signal after filtering
- Fs: sampling frequency (in Hz)
Author: Tikea TE
Date: 16/04/2025
%}
n = length(rawSignal);
t = (0:n-1) / Fs;
figure;
plot(t, rawSignal, 'r');
hold on;
plot(t, filteredSignal, 'b');
xlabel("Time (s)");
ylabel("Amplitude (a.u.)");
title("Raw Signal vs Filtered Signal");
legend("Raw", "Filtered");
grid on;
end