How to smooth a curve with movmean with consideration of the start and end of an array?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello.
I am trying to smooth out a curve with movmean.
My current code looks like this:
Start_i_len = 8;
smooth_offset = cell(Start_i_len, 1);
for i = 1:1:Start_i_len
smooth_offset{i} = movmean(Offset_itpl_mean{i}, 301);
end
The cell array contains 8 cells, with each consisting of 8192 values. What I want to do is, as it samples 301 values, I want it to connect the beginning and the end of the array (If that makes sense). So that when it smoothes out the values at the nearing the end of the array, it does so with consideration of the values at the start of the array and vice versa. Any ideas on how to do it?
0 Commenti
Risposte (1)
Matt J
il 16 Mar 2022
Modificato: Matt J
il 16 Mar 2022
k=ones(1,301); k(8192)=0;
for i = 1:1:8
tmp=fwd.Offset_itpl_mean{i}(:).';
tmp=ifft(fft(tmp).*fft(k),'symmetric');
fwd.smooth_offset{i} = tmp;
end
4 Commenti
Vedere anche
Categorie
Scopri di più su Spline Postprocessing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!