![00_Screenshot.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270760/00_Screenshot.png)
Smooth data for slowly-sampled data
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270755/smooth_data.png)
0 Kommentare
Antworten (2)
Image Analyst
am 10 Feb. 2020
Try sgolayfilt() in the Signal Processing Toolbox. That's one way.
See my attached demo.
![00_Screenshot.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270760/00_Screenshot.png)
3 Kommentare
Image Analyst
am 10 Feb. 2020
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?
Akira Agata
am 10 Feb. 2020
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270761/interp.png)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!