Filter data that is not sampled uniformly?

Hi, does anyone know how to filter data that's not sampled at a constant frequency? The data is based on pressure-crank angle, so I have a pressure sample at every 0.1 crank angle degree.
I'm trying to the use butter() function, but it requires a sampling frequency...
Regards, TheNovice

댓글 수: 4

dpb
dpb 2015년 3월 1일
What is the intended purpose for the filtering, first?
TheNovice
TheNovice 2015년 3월 1일
편집: TheNovice 2015년 3월 1일
To smooth the data by filtering the high frequency content. I need a low-pass filter.
dpb
dpb 2015년 3월 1일
Is there a recorded timing interval or other way to know rpm, I presume? If so you can derive time. I'll have to cogitate on w/o a little...
TheNovice
TheNovice 2015년 3월 1일
편집: TheNovice 2015년 3월 1일
I have an average rpm of 1000 in the attached sample. So yeah, I can reconstruct a time vector with uniform distribution from that. The problem I see though is that the RPM is not constant during a cycle, and this approach will contribute to an error. The question is how large...

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2015년 3월 1일

0 개 추천

I have no mechanical engineering background, so I’m having a difficult time imaging what your data actually are. If it is constantly sampled, you could filter them with respect to the crank angle, or interpolate (resample) them at a constant sampling frequency in time. I have no idea how valid this may be, since I don’t have your data.

댓글 수: 9

TheNovice
TheNovice 2015년 3월 1일
Thank you for your answer.
To clarify, the data collected is synchronized with the crank angle of the engine. So every 0.5 crank angle degree the cylinder pressure is sampled. So the data is uniform w.r.t. crank angle, but not in time since the engine speed varies.
I have little experience in signal processing, so that's why I'm a bit stuck when Matlab requires me to give a sample frequency... This is actually the first time I am working with data that is not sampled w.r.t. time.
Star Strider
Star Strider 2015년 3월 1일
My pleasure.
Since engine speed varies, I would expect the frequency content of your recorded signal to vary with engine speed as well. I would have to see a representative sample of your data (time, engine speed, pressure, other variables) in order to suggest a possible approach. If you want to attach some of your data, a .mat-file is best. (It’s best if you attach it to your original Question — use ‘Edit’ — to make it easy to find.) I can’t promise results.
Also, what specifically are you filtering? In the future, it might be best to implement a filter in hardware and use it between your instrumentation and ADC. That would be independent of engine speed, sampling frequency, and other experimental conditions.
TheNovice
TheNovice 2015년 3월 1일
I've attached a sample as requested. The data that is available is only crank angle degree (CAD) and pressure.
Unfortunately I only have an average speed for one cycle, not the instant speed at every sample, and that is 1000 RPM at the attached sample.
I want to low-pass filter the data to get rid of that high frequency content.
Thank you for the tip, I will look into that.
Star Strider
Star Strider 2015년 3월 1일
편집: Star Strider 2015년 3월 1일
I believe your signal is perfect for a Savitsky-Golay filter. (See also: sgolay.) It doesn’t dare about the details — it just produces a noise-free signal.
Experiment with the filter parameters to get the result you want:
L = load('TheNovice sample.mat')
x = L.CAD;
y = L.Pcyl_sample;
N = 2;
F = 21;
yf = sgolayfilt(y, N, F);
figure(1)
plot(x, y)
hold on
plot(x, yf, '-r', 'LineWidth',1)
hold off
grid
produces this plot:
TheNovice
TheNovice 2015년 3월 1일
Wow, thank you. I have no experience of Savitsky-Golay filters so I just thought of defaulting to a Butterworth. This will save me alot of headache if it works satisfactory.
I just quickly googled it and found this paper (PDF) Digital signal processing of cylinder pressure data for combustion diagnostics of HCCI engine. They state that Savitsky-Golay is superior to a Butterworth filter. How practical!
Bit off-topic but, do you have any good suggestion of a reference book in signal processing and especially filtering?
Image Analyst
Image Analyst 2015년 3월 1일
I never use Butterworth and always use Savitzky-Golay. Savitzky-Golay will follow local variations better since it only filters within a localized window whereas a Butterworth filters the whole signal . I think that might be why the sgolayfilt seemed to give pretty good retention of the spike in the picture above.
Star Strider
Star Strider 2015년 3월 1일
편집: Star Strider 2015년 3월 1일
My pleasure!
I don’t have a lot of experience with Savitsky-Golay filters, since in biomedical signal processing and analysis, we pretty much always have uniformly-sampled signals, hardware anti-aliasing filters ahead of the ADCs, and other conveniences. They seem to be perfect for your application, however.
There are a number of good signal processing textbooks. (A number of MATLAB based books are available here.) The one I’ve used since grad school (and updated as new editions emerged) is Proakis and Manolakis, Digital Signal Processing: Principles, Algorithms, and Applications (Fourth Edn.), ISBN: 0-13-187374-1. Also see the MathWorks Academia section.
As for analogue signal processing, my gold-standard is Chen, Passive and Active Filters: Theory and Implementations, ISBN: 0-471-82352-X.
There may be later editions of both of these, so I would search for them, especially since the later editions would use later versions of MATLAB and toolboxes. Hardware filters are relatively easy to design and build (‘cookbook’ design sources are available for a number of active filters using op-amps), and they generally perform quite well.
I would go with a hardware low-pass filter in your application in the future, if you know that your signals are always within a specific frequency range. If you can expect significant baseline drift (that you would not want as part of your signal), consider a bandpass filter with a low-frequency cutoff to eliminate the baseline drift, as well as a high-frequency cutoff to eliminate the high-frequency noise.
TheNovice
TheNovice 2015년 3월 1일
편집: TheNovice 2015년 3월 1일
Thank you the very informative answer. You have a lot of good points that I will consider in the future. Also a thank you for the suggested books, will definitely look into them. This is an area I need more knowledge of.
Thank you again for your help!
Regards, TheNovice
Star Strider
Star Strider 2015년 3월 1일
My pleasure!
From my own experience, I would take courses on digital signal processing, experiment design, mathematical modeling and nonlinear parameter estimation, and if you are going to do a significant amount of instrumentation design, a course in hardware design and hardware signal processing. If you are doing imaging in your research, a course in digital image processing would also be necessary.
Your research seems interesting. Have fun!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2015년 3월 1일

댓글:

2015년 3월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by