signal-processing

MATLAB sound generation with increased dB-value

柔情痞子 提交于 2019-12-18 09:45:35
问题 This may look like an easy question for some of you, but I'm not very familiar with signal processing, and I'd rather be sure about this. So I've found some easy code to generate a pure tone in MATLAB: Fs = 44100; duration = 5.0; numberOfSamples = Fs * duration; samples = (1:numberOfSamples) / Fs; s = sin(2 * pi * freq * samples); sound(s, Fs); I'd like to be able to adjust the volume in terms of dB here. More precisely, I want to introduce a certain parameter, say dbOffset , which, after

High Pass Butterworth Filter on images in MATLAB

我的梦境 提交于 2019-12-18 06:35:12
问题 I need to implement a high pass Butterworth filter in MATLAB for the purposes of image filtering. I have implemented one but it looks like it doesn't work. Here is the code I have written. Can anyone tell me what is wrong? n=1; d=50; A=1.5; im=imread('imagex.jpg'); h=size(im,1); w=size(im,2); [x y]=meshgrid(-floor(w/2):floor(w-1/2),-floor(h/2):floor(h-1/2)); hhp=(1./(d./(x.^2+y.^2).^0.5).^(2*n)); image_2Dfilter=fftshift(fft2(im)); Image_butterworth=image_2Dfilter; imshow(Image_butterworth);

Low pass filter using FFT instead of convolution implementation

守給你的承諾、 提交于 2019-12-18 04:54:21
问题 Implementing a low pass FIR filter, when should one use FFT and IFFT instead of time-domain convolution? The goal is to achieve the lowest CPU time required for real-time calculations. As I know, FFT has about O(n log n) complexity, but convolution in the time domain is of O(n²) complexity. To implement a low pass filter in the frequency domain, one should use FFT, then multiply each value with filtering coefficients (which are translated into frequency domain), then make IFFT. So, the

MATLAB: filter noisy EKG signal

我的梦境 提交于 2019-12-18 03:01:13
问题 What is the best filter to use to remove noise from an ECG signal with matlab? 回答1: If you have access to the Signal Processing Toolbox , then check out the Savitzky-Golay filter, namely the function sgolay. There's an accompanying demo, just run sgolaydemo . The following is an example to show the various ways you can apply filtering and de-noising to a signal. Note some of these functions requires certain toolboxes to be present: % load ecg: simulate noisy ECG Fs=500; x = repmat(ecg(Fs), 1,

How To apply a filter to a signal in python

大城市里の小女人 提交于 2019-12-17 23:47:10
问题 is there any prepared function in python to apply a filter (for example Butterworth filter) to a given signal? I looking for such a function in 'scipy.signal' but I haven't find any useful functions more than filter design ones. actually I want this function to convolve a filter with the signal. 回答1: Yes! There are two: scipy.signal.filtfilt scipy.signal.lfilter There are also methods for convolution ( convolve and fftconvolve ), but these are probably not appropriate for your application

How do I run a high pass or low pass filter on data points in R?

China☆狼群 提交于 2019-12-17 21:43:33
问题 I am a beginner in R and I have tried to find information about the following without finding anything. The green graph in the picture is composed by the red and yellow graphs. But let's say that I only have the data points of something like the green graph. How do I extract the low/high frequencies (i.e. approximately the red/yellow graphs) using a low pass/high pass filter? Update: The graph was generated with number_of_cycles = 2 max_y = 40 x = 1:500 a = number_of_cycles * 2*pi/length(x) y

How to get the fundamental frequency using Harmonic Product Spectrum?

对着背影说爱祢 提交于 2019-12-17 20:40:11
问题 I'm trying to get the pitch from the microphone input. First I have decomposed the signal from time domain to frequency domain through FFT. I have applied Hamming window to the signal before performing FFT. Then I get the complex results of FFT. Then I passed the results to Harmonic product spectrum, where the results get downsampled and then multiplied the downsampled peaks and gave a value as a complex number. Then what should I do to get the fundamental frequency? public float[]

Why do I need to apply a window function to samples when building a power spectrum of an audio signal?

旧时模样 提交于 2019-12-17 17:41:43
问题 I have found for several times the following guidelines for getting the power spectrum of an audio signal: collect N samples, where N is a power of 2 apply a suitable window function to the samples, e.g. Hanning pass the windowed samples to an FFT routine - ideally you want a real-to-complex FFT but if all you have a is complex-to-complex FFT then pass 0 for all the imaginary input parts calculate the squared magnitude of your FFT output bins (re * re + im * im) (optional) calculate 10 *

Why do I need to apply a window function to samples when building a power spectrum of an audio signal?

雨燕双飞 提交于 2019-12-17 17:41:15
问题 I have found for several times the following guidelines for getting the power spectrum of an audio signal: collect N samples, where N is a power of 2 apply a suitable window function to the samples, e.g. Hanning pass the windowed samples to an FFT routine - ideally you want a real-to-complex FFT but if all you have a is complex-to-complex FFT then pass 0 for all the imaginary input parts calculate the squared magnitude of your FFT output bins (re * re + im * im) (optional) calculate 10 *

Plotting power spectrum in python

不想你离开。 提交于 2019-12-17 17:24:38
问题 I have an array with 301 values, which were gathered from a movie clip with 301 frames. This means 1 value from 1 frame. The movie clip is running at 30 fps, so is in fact 10 sec long Now I would like to get the power spectrum of this "signal" ( with the right Axis). I tried: X = fft(S_[:,2]); pl.plot(abs(X)) pl.show() I also tried: X = fft(S_[:,2]); pl.plot(abs(X)**2) pl.show() Though I don't think this is the real spectrum. the signal: The spectrum: The power spectrum : Can anyone provide