# How to filter a signal with lowpass/highpass?

3 views (last 30 days)
Jose Rego Terol on 26 Mar 2020
Commented: Star Strider on 29 Mar 2020
Hi all,
I am completely new in this field. Therefore, I need some help from the scratch.
According to a protocol, I have to filter a signal at 1.2 kHz ("the current derivative (of the signal) was addicionally filter at 1.2 kHz (sic)).
I've tried to filter the signal using the funtion lowpass:
y = lowpass(x,fpass,fs) %specifies that x has been sampled at a rate of fs hertz. fpass is the passband frequency of the filter in hertz)
x is my data, fpass is 1200 (1.2 kHz), but fs? I've checked the protocol and I've found this: "current signals were filtered at 2 kHz and digitized gap-free at 25 kHz."
So, what is the fs in my case? 2000, 25000, or 27000 (2000 + 25000)?
My main question is: how can I filter the signal at 1.2 kHz?
I've attached the data (Trial file). There are two variables (1x26 double), Time (s) and Intensity (pA). Plot it as (Time,Intensity).
Many thanks,
Jose

Star Strider on 26 Mar 2020
The easiest way to determine the sampling frequency is to measure it:
A = D.Intensity;
t = D.Time;
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
The sampling frequency is 6250 (Hz, assuming ‘t’ is in seconds), and appears to have been sampled regularly (i.e. the sampling intervals are essentially identical). Define the passband of a filter so long as it is less than the Nyquist frequency, Fs/2, so a passband or stopband of 1.2kHz is possible.
I have no idea what ‘...current signals were filtered at 2 kHz and digitized gap-free at 25 kHz.’ means. You have to sort that.
Star Strider on 29 Mar 2020
To the best of my knowledge, it would be necessary to load all the files and then search each file for the variables of interest. I doubt that there is any other way to determine that.