33 lines
704 B
Matlab
33 lines
704 B
Matlab
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
|