create a new mfile to make it plot raw vs filtered
This commit is contained in:
parent
b5b044a6e4
commit
a56c7d75cd
|
|
@ -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
|
||||
Loading…
Reference in New Issue