Filter data samples with a low pass filter designed with "Filter Designer" App

4 views (last 30 days)
Hi Matlab and Filter Pros,
I`m currently struggeling to filter my sampled data with a propper filter.
Sampling Rate: sr = 20.000 Hz
Sampling time: t = 6.5536 s
Sampling data: n = 131072
Filter frequency: fs = 9.999 Hz (low pass filter)
I tried to built my own low pass filter with the Filter Designer App (s. Figure)
My Code in Matlab looks like this:
% %%Filtering the signal
Filter = BandPassFilter; % With Filter Designer built filter
%
Signal = VoltageSignal; % Original Signal with 131072 Data Points [V], sampled with sr = 20.000 Hz
time = TimeSignal; % Timestamps during the measurement, equivalent to (linspace(0,t,n))
%
%
%noise signal to test the filter
fnoise1 = 4000; %under the low pass frequency [Hz]
fnoise2 = 10000; %the low pass frequency [Hz]
fnoise3 = 15000; %over the low pass frequency [Hz]
noise = 0.002 * (cos(2 * pi * fnoise1 * Time) + cos(2 * pi * fnoise2 * Time)+ cos(2 * pi * fnoise3 * Time)); % Noise with different cos frequencies
NoisySignal = noise'; % Or: (NoisySignal = Signal + noise') and the noise to the original signal
%
FilteredSignal = filter(Filter, Signal); %apply the filter to the original signal
FilteredNoisySignal = filter(Filter, NoisySignal); %apply the filter to the noisy signal
%
OriginalSignalTransform = fft(Signal); %apply a fast fourier transormation to the original signal
NoisySignalTransform = fft(NoisySignal); %apply a fast fourier transormation to the noisy signal
FilteredSignalTransform = fft(FilteredSignal); %apply a fast fourier transormation to the filtered original signal
FilteredNoisySignalTransform = fft(FilteredNoisySignal); %apply a fast fourier transormation to the filtered noisy signal
When I plot these signals I end up getting this:
When you zoom in the "filtered" original signal looks even worse.
The filtered noisy signal looks like the unfiltered noisy signal, just the amplitude is smaller.
Looks like the transformed signal are "mirrored" at 10.000 Hz.
At least the 10.000 Hz in the noisy signal disappeared :-D
What am I doing wrong? I tried different settings with my low pass filter and I even tried band pass filters.
Does anybody know whats wrong?
Thank you so much in advance for helpful answers.
Regards
Fabi

Answers (0)

Categories

Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!