How can I use the envelope function for the following plot?

6 visualizzazioni (ultimi 30 giorni)
Hello!
I'm extremely new to Matlab and really need some help to implement my project!
How is it possible to smoothen the set of data on this plot- enclosed screen shot (initially it is a signal, .wav file)? I tried using envelope function, slmengine, hilbert but still of no use.
I also tried getting rid of the inf values and using filtering to make the further processing of the data easier.
Any help appreciated. My little code is below.
file = '/Users/mac/Desktop/clap101cm.wav';
[wave,Fs] = audioread(file);
sound(wave,Fs);
Nsamps = length(wave);
t = (1/Fs)*(1:Nsamps);
ydb = mag2db(wave);
new_sound = ydb(:,1);
smtlb = sgolayfilt(new_sound,3,11);
smtlb(isinf(smtlb))=NaN;
plot(t, smtlb);
windowSize =length(smtlb);
b = (1/windowSize)*ones(1,windowSize);
a = 1;
y = filter(b,a,smtlb);
hold on
plot(t,y)
grid on
xlabel('Time (s)')
ylabel('Amplitude, (dB)')
title('Clap decay.big')

Risposte (1)

Image Analyst
Image Analyst il 4 Ago 2015
Modificato: Image Analyst il 4 Ago 2015
You forgot to attach your data in a .mat file. How about using sgolayfilt() if you have the Signal Processing Toolbox. It fits the data in a sliding window to a polynomial. You have control over the window size and polynomial order. There are other methods based on frequency like butterworth or Fourier filtering. It's a sound file - why do you need to smooth it?
  4 Commenti

Accedi per commentare.

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by