필터 지우기
필터 지우기

Smooth data for slowly-sampled data

조회 수: 3 (최근 30일)
Dave Lee
Dave Lee 2020년 2월 10일
편집: Dave Lee 2020년 2월 10일
Hi,
I have a data sampled slow as blue. I need to obtain the red curve that smoothen out the data. Can anyone please tell me what Matlab command to handle this?
Thanks,
Dave
smooth_data.PNG

답변 (2개)

Image Analyst
Image Analyst 2020년 2월 10일
Try sgolayfilt() in the Signal Processing Toolbox. That's one way.
See my attached demo.
00_Screenshot.png
  댓글 수: 3
Image Analyst
Image Analyst 2020년 2월 10일
How does it lead to phase lag? The window is centered over the point so it uses points both ahead of and behind the signal so the filter value is at exactly the same time point as the original signal. What elements do you want to include when you are getting the smoothed output value at a particular time point?
Dave Lee
Dave Lee 2020년 2월 10일
편집: Dave Lee 2020년 2월 10일
Hi,
I obtained the following result. I wanted to have the black smoother and tried the red to the level I wanted but it looks lag. Not exactly lag all the time I suppose but some averaging characteristics makes it deviate more from the raw data. The deviation of the black is better.
Thanks, Dave

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


Akira Agata
Akira Agata 2020년 2월 10일
How about applying interpolation?
The following is an example:
% Original data
time = 1:10;
value = rand(1,10);
% Apply interpolation
time2 = linspace(1,10);
value2 = interp1(time,value,time2,'pchip');
% Visualize the result
figure
scatter(time,value)
hold on
plot(time2,value2)
legend({'Original data','After interpolation'},'FontSize',12)
grid on
box on
interp.png
  댓글 수: 1
Dave Lee
Dave Lee 2020년 2월 10일
Hi,
Thanks for your suggestion. I had thought of interp1 as well but it doesn't work for the purpose. The data is flat during sampling, as you can see about 1 sec. Doing interpolation with finer sampling of 0.1sec for example will just keep the same value during the sampling of 1sec.
Dave

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

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by