Finding the best parameters for Savitzky-Golay filter
0 Comments
Answers (2)
3 Comments
HOW TO KNOW THE ORDER AND FRAMELENGTH ??
clc
clear all
close all
[x,fs]=audioread('Record_0001.wav'); %load the sound
sound(x,fs)
pause(3)
figure(1)
plot(x)
x = x+(randn(size(x)));
figure(2)
plot(x)
sound (x,fs);
pause(3)
order = 8;
framelen = 21;
b = sgolay(order,framelen);
y = conv(x,b((framelen+1)/2,:),'valid');
z = b(end:-1:(framelen+3)/2,:) * x(framelen:-1:1);
z1 = b((framelen-1)/2:-1:1,:) * x(end:-1:end-(framelen-1));
sound(x)
z3 = sgolayfilt(x,7,41);
y = [z; y; z1];
figure(3)
plot([x y])
legend('Noisy Sinusoid','S-G smoothed sinusoid')
figure(4)
sound(z3,fs)
subplot(2,1,1) plot(1:2000, x(1:2000)) axis([0 2000 -4 4]) title('mtlb') grid
subplot(2,1,2) plot(1:2000,z3(1:2000)) axis([0 2000 -4 4])
title('smtlb') grid
graph_of_input_speech
graph_of_input_speech_with_noise
graph after using sgolay
couldn't get desired output
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!