![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/679128/image.png)
Signal smoothing for logarithmic timescale
조회 수: 19 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678988/image.jpeg)
I want to perform signal smoothing for the graph shown above. However, using the method shown in MATLAB documentation is not working since the timescale for my graph is logarithmic (logspace(1,5,1000)), not linear. How can I smooth this using a filter?
댓글 수: 0
채택된 답변
Mathieu NOE
2021년 7월 9일
hello
you can smooth data even in log spacing
a demo code is provided below. I kept the amount of samples low , so the smoothed curve is easy to see that the constant log spacing is still there.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/679128/image.png)
clc
clearvars
% dummy data : x is Logarithmically spaced vector
samples = 100;
xlog = logspace(1,5,samples);
ylog = (1-exp(-xlog*1e-4)).*randn(1,samples);
% smoothdata
N = 25;
ylogs = smoothdata(ylog,"gaussian",N);
semilogx(xlog,ylog,xlog,ylogs,'-*');
legend ('raw data','smoothed');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!