How to filter a signal with lowpass/highpass?

4 views (last 30 days)
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

Accepted Answer

Star Strider
Star Strider on 26 Mar 2020
The easiest way to determine the sampling frequency is to measure it:
D = load('trial1.mat');
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.
  10 Comments
Jose Rego Terol
Jose Rego Terol on 29 Mar 2020
I doubt it. This instance has a regularly-sampled vector, so you could use one scalar ‘h’ without problems. I was demonstrating a situation where the sampling intervals are not regular, so doing the element-wise division produces an accurate numerical derivative that would not be possible otherwise. That does not apply to your vector, I was simply iillustrating that solution.
Got it!
I want to ask you for a completely different thing. I have a large number of .txt files in a folder and, I want to know which one has a variable (fi spor._M). For example, files a, b, c, and f have these variables but d, and f do not have this variable.
I was using find(fi spor._M) but I get the number of matches (e.g. 8). I do not know how many times this variable is written in each file. It could be that the variable appears in eight files or 1 file, but eight times. Do you catch me?
What I want is to display the name of the files that this variable appears.
Star Strider
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!