Signal smoothing for logarithmic timescale

18 Ansichten (letzte 30 Tage)
Divij Gupta
Divij Gupta am 9 Jul. 2021
Kommentiert: Mathieu NOE am 9 Jul. 2021
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?

Akzeptierte Antwort

Mathieu NOE
Mathieu NOE am 9 Jul. 2021
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.
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');
  2 Kommentare
Divij Gupta
Divij Gupta am 9 Jul. 2021
Thank you so much! This works perfectly
Mathieu NOE
Mathieu NOE am 9 Jul. 2021
My pleasure

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by