# How can i remove the background noise of my signal?

130 views (last 30 days)
Rory Hill on 10 Mar 2014
Answered: Image Analyst on 11 Mar 2014
I have created a sine sweep wave and recorded it using four microphones to the file s1m1(960000:4). I have also recorded the background noise from the room without the sine sweep playing as backgroundroom2(960000:4) using the same four microphones. Both of these files have been attached. I have tried to remove the background noise from my file s1m1 using the answer to a similar problem: http://www.mathworks.com/matlabcentral/answers/106510#answer_115590 but this did not work. Does anyone else have any suggestions?
Thanks, Rory

Image Analyst on 11 Mar 2014
See the Mathworks official recommendation: <http://www.mathworks.com/matlabcentral/answers/103916-how-can-i-smooth-a-signal-while-preserving-peaks-in-matlab-r2013a. Basically use a Savitky-Golay filter. Why would that work so well in your situation? Well you know from the Taylor series that a sine wave is like a0 + a1*x + a3*x^3 + fifth and higher odd orders. So a Siviztky Golay filter with a 3rd order would be about perfect. Here's a demo for you:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 25;
% Make a noisy sine wave signal
x = 1 : 300;
period = 50
y = sin(2*pi*x/period);
noiseAmplitude = 0.8;
y = y + noiseAmplitude * rand(size(y));
subplot(2,1,1);
plot(x, y, 'b-', 'LineWidth', 2);
title('Noisy Signal', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Now smooth with a Savitzky-Golay sliding polynomial filter
windowWidth = 27
polynomialOrder = 3
smoothY = sgolayfilt(y, polynomialOrder, windowWidth);
subplot(2,1,2);
plot(x, smoothY, 'b-', 'LineWidth', 2);
title('Smoothed Signal', 'FontSize', fontSize); Youssef Khmou on 11 Mar 2014
hi, One of the ways to handle this problem is to treat the signal in frequency domain, after applying the Fourier transform try to delete the unwanted frequencies and/or smooth the wideband spectrum of the sweep, i realized that there are two types of peaks , wide and narrow , try to start with these tests, on first signal, once the operation is good , apply it to three left signals :
f1=(fft(s1m1(:,1)));
t=f1;
t(abs(t)<30)=0;
z=ifft(t);
sound(z)
figure; plot(abs(t))
figure; plot(real(t))
figure; plot(imag(t))