I have a signal that has been distorted by narrowband noise.
A zoomed in image of it's spectral analysis:
I know that frequencies intervals, that I coloured in yellow are noise and the ones I coloured in green are the original signal.
I could design filters just by hardcoding interval values from what I see, but I would like to automate the process and make an algorithm finding the noise intervals automatically.
Could you please suggest an approach (or maybe a function) that would be suitable here?
Try using pwelch(x) a command of matlabs dsp (digital signal processing) toolbox.
This function is specialized to differ between noise and signal.
Related
I am plotting some data I collected at 10000 Hz, I attached a snip of some of the data in the form of an FFT and time. I am getting a repeating frequency around 10Hz that seems to be pretty obviously some sort of noise from the system i am testing. The signal shows up in the time domain and also the frequency domain.
I am looking to use MATLAB to remove these spikes.
Has anyone dealt with a similar issue and can provide any advice.
To filter out specific frequency components of a signal, you would normally use either a notch filter or a comb filter, for which MATLAB already has some commands in the DSP System Toolbox:
https://www.mathworks.com/help/dsp/ref/iirnotch.html
https://www.mathworks.com/help/dsp/ref/fdesign.comb.html
Alternatively, if you have the Signal Processing Toolbox, you can use the band-stop Butterworth filter to remove individual frequency components (ranges) using
https://www.mathworks.com/help/signal/ref/butter.html
I'm applying different windows to a signal and then get the frequency responses using fft function in MATLAB. The idea is to isolate the peaks of the signal, removing the noise and reverberation.
Different windows:
My frequency responses:
Zoom in the peak:
I don't understand the reasons why there're differences, especially the peak I get using Gaussian (figure 3). I know using the Gaussian with small standard deviation I can get rid of the noise, getting a cleaner signal.
Why does this happen? Can you guys give an scientific explanition?
Thank you.
There are two relevant phenomena here:
Windows that are narrower in the time domain have a broader frequency response, and windows that are wider in the time domain have a narrower frequency response.
Multiplication of a signal with a window in the time domain is equivalent to convolution in the frequency domain
Your Gaussian window with a small standard deviation is narrower in the time domain than the other windows, so it has a wider frequency response. Convolution of this wide frequency response with the spectrum of the un-windowed signal smooths out the frequency response of the windowed signal.
Of course this smoothing comes with trade-offs. As you make your window narrower in the time domain, the spectrum of the windowed signal will become smoother, but the resolution will become increasingly coarse.
.
I have an acoustic waveform of a Spanish phoneme and I'd like to compute its magnitude spectrum and plot it in dB magnitude on a linear frequency scale. How would I be able to accomplish this in MATLAB?
Thanks
First a quick heads up: At stackoverflow you are expected to show some of your own efforts to solve the problem and then ask for help.
Now to your question:
You can plot the spectrogram using the "spectrogram" Matlab function.
[s,f,t] = spectrogram(x,window,noverlap,f,fs)
Check the details here: https://www.mathworks.com/help/signal/ref/spectrogram.html
For a speech signal you will want to specify the sampling frequency "fs" (you can get that when you read the file using:
[y,Fs] = audioread(filename)
You will probably want to specify the variables "window" and "noverlap" since speech signals can show distinct properties depending on the dimension of the window (fast phenomena will not be visible on big windows ). A typical values are 20ms windows with 10ms overlap (select the best value by considering your sampling frequency and the nearest 2^n value for fast Fourier calculation).
The window size and overlap are also valid when you calculate spectrum. If you apply FFT to the whole waveform then you will get the "average" spectral information for the sentence. To catch specific phenomena you must use windowing techniques and perform a short-term Fourier analysis.
use sptool
Signal Processing toolbox Show its Document
Could anybody explian how to use Wiener filter to revocer the audio signal from low-pass filter in Matlab?
I filtered the signal, after that I used simple deconvolution by dividing filtered signal with frequency response of the LPF, but it didnt give me any result. I didnt get restoration at all. I have checked the LPF, it works correct. I need some information about using Wiener filter for audio files, but there are only answers about deblurring images. Thank you in Advance!
I will attempt to provide some help.
You should study the normal equations as per section 11.11
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-011-introduction-to-communication-control-and-signal-processing-spring-2010/readings/MIT6_011S10_chap11.pdf
This set of equations will appear in every literature on the Wiener filter. The objective regardless of the application is to compute from a noisy observation signal a clean - but reconstructed - version of the clean input signal. Since this is a mathematical model, the quality of the reconstruction is based on how good are the computed statistics and characteristics of the "noise". Noise in audio is always uncorrelated statistically to the clean signal. This is the principle upon which the Wiener filter works.
Figure 11.3 gives an example of deconvolution in block diagram form that should suffice to solve your application in audio. A real Wiener filter minimizes the MMSE ratio as defined in 11.37. That is the difference in expectation of the square of the e(t) process.
I have a set of experimental data s(t) which consists of a vector (with 81 points as a function of time t).
From the physics, this is the result of the convolution of the system response e(t) with a probe p(t), which is a Gaussian (actually a laser pulse). In terms of vector, its FWHM covers approximately 15 points in time.
I want to deconvolve this data in Matlab using the convolution theorem: FT{e(t)*p(t)}=FT{e(t)}xFT{p(t)} (where * is the convolution, x the product and FT the Fourier transform).
The procedure itself is no problem, if I suppose a Dirac function as my probe, I recover exactly the initial signal (which makes sense, measuring a system with a Dirac gives its impulse response)
However, the Gaussian case as a probe, as far as I understood turns out to be a critical one. When I divide the signal in the Fourier space by the FT of the probe, the wings of the Gaussian highly amplifies those frequencies and I completely loose my initial signal instead of having a deconvolved one.
From your experience, which method could be used here (like Hamming windows or any windowing technique, or...) ? This looks rather pretty simple but I did not find any easy way to follow in signal processing and this is not my field.
You have noise in your experimental data, do you? The problem is ill-posed then (non-uniquely solvable) and you need regularization.
If the noise is Gaussian the keywords are Tikhonov regularization or Wiener filtering.
Basically, add a positive regularization factor that acts as a lowpass filter. In your notation the estimation of the true curve o(t) then becomes:
o(t) = FT^-1(FT(e)*conj(FT(p))/(abs(FT(p))^2+l))
with a suitable l>0.
You're trying to do Deconvolution process by assuming the Filter Model is Gaussian Blur.
Few notes for doing Deconvolution:
Since your data is real (Not synthetic) data it includes some kind of Noise.
Hence it is better to use the Wiener Filter (Even with the assumption of low variance noise). Otherwise, the "Deconvolution Filter" will increase the noise significantly (As it is an High Pass basically).
When doing the division in the Fourier Domain zero pad the signals to the correct size or better yet create the Gaussian Filter in the time domain with the same number of samples as the signal.
Boundaries will create artifact, Windowing might be useful.
There are many more sophisticated methods for Deconvolution by defining a more sophisticated model on the signal and the noise. If you have more prior data about them, you should look for this kind of framework.
You can always set a threshold on the amplification level for certain frequencies, do that if needed.
Use as much samples as you can.
I hope this will assist you.