signal-processing

Using Goertzel algorithm to detect frequency

橙三吉。 提交于 2019-12-04 13:36:39
问题 I am trying to write a program for android to detect frequency using Goertzel algorithm. However when I apply the algorithm on the data that I get from the AudioRecord read() method, the magnitude does not peak on the target frequency (.i.e: it usually peak on low frequency). Am I misunderstanding anything? protected void detect() { double[] dbSample = new double[bufferSize]; short[] sample = new short[bufferSize]; max_magnitude = 0; while(isRecording){ int bufferReadResult = recorder.read

What's the fastest way to approximate the period of data using Octave?

独自空忆成欢 提交于 2019-12-04 13:28:02
问题 I have a set of data that is periodic (but not sinusoidal). I have a set of time values in one vector and a set of amplitudes in a second vector. I'd like to quickly approximate the period of the function. Any suggestions? Specifically, here's my current code. I'd like to approximate the period of the vector x(:,2) against the vector t. Ultimately, I'd like to do this for lots of initial conditions and calculate the period of each and plot the result. function xdot = f (x,t) xdot(1) =x(2);

EEG raw data band filtering using matlab

烂漫一生 提交于 2019-12-04 12:40:46
I have some raw EEG data in csv files captured using Emotiv EPOC as part of experiments I am doing for my undergrad thesis. I uploaded one of the files here for reference. I wish to perform band pass filtering on the data in the certain bands delta (1-4Hz) theta (4-8Hz) alpha (8-13Hz) beta (13-30Hz) and gamma (36- 40Hz) As I am relatively new in Matlab, how can I do that? I am aware that similar questions already exist but they do not apply in my case as I am using Emotiv EPOC for EEG data capturing You may try to use EEGLab , an open source environment for electrophysiological signal

Help with resampling/upsampling

假如想象 提交于 2019-12-04 12:22:49
I have an array of 240 data points sampled at 600hz, representing 400ms. I need to resample this data to 512 data points sampled at 1024hz, representing 500ms. I assume since I'm starting with 400ms of data, the last 100ms will just need to be padded with 0s. Is there a best approach to take to accomplish this? If you want to avoid interpolation then you need to upsample to a 76.8 kHz sample rate (i.e. insert 127 0s after every input sample), low pass filter, then decimate (drop 74 out of every 75 samples). You can use windowed Sinc interpolation, which will give you the same result as

How to implement a LowPass Filter?

↘锁芯ラ 提交于 2019-12-04 12:15:39
问题 I'm doing some math on both gyroscope and accelerometer data combined and I'd like to low pass filter the resulting data. So could someone post some generic code for a Low Pass filter? 回答1: A 1st order IIR low-pass filter can be of the form: output_value = rate * input_value + (1.0 - rate) * previous_output_value; which is pretty much what's inside Apple's AccelerometerGraph example. You select the rate parameter depending on what frequency (very very roughly shakes per second) you want to

Identifying common periodic waveforms (square, sine, sawtooth, …)

China☆狼群 提交于 2019-12-04 11:44:17
问题 Without any user interaction, how would a program identify what type of waveform is present in a recording from an ADC? For the sake of this question: triangle, square, sine, half-sine, or sawtooth waves of constant frequency. Level and frequency are arbitrary, and they will have noise, small amounts of distortion, and other imperfections. I'll propose a few (naive) ideas, too, and you can vote them up or down. 回答1: You definitely want to start by taking an autocorrelation to find the

Software Phase Locked Loop example code needed

人走茶凉 提交于 2019-12-04 11:42:37
问题 Does anyone know of anywhere I can find actual code examples of Software Phase Locked Loops (SPLLs) ? I need an SPLL that can track a PSK modulated signal that is somewhere between 1.1 KHz and 1.3 KHz. A Google search brings up plenty of academic papers and patents but nothing usable. Even a trip to the University library that contains a shelf full of books on hardware PLL's there was only a single chapter in one book on SPLLs and that was more theoretical than practical. Thanks for your time

How to capture raw signal from wireless router?

Deadly 提交于 2019-12-04 11:35:15
问题 I have seen several projects now which derive novel spatial information from radio data collected from a typical wireless router: http://wisee.cs.washington.edu/ http://www.extremetech.com/extreme/133936-using-wifi-to-see-through-walls The idea of using a wireless router as a sort of passive radar is fantastic. I am very interested in experimenting with data collected from a wireless router myself, but there is little information on how to go about actually interfacing with a wireless router

Different spectrogram between MATLAB and Python

限于喜欢 提交于 2019-12-04 11:17:32
I have a program in MATLAB which I want to port to Python. The problem is that in it I use the built-in spectrogram function and, although the matplotlib specgram function seems identical, I'm getting different results when I run both. These is the code I've been running. MATLAB: data = 1:999; %Dummy data. Just for testing. Fs = 8000; % All the songs we'll be working on will be sampled at an 8KHz rate tWindow = 64e-3; % The window must be long enough to get 64ms of the signal NWindow = Fs*tWindow; % Number of elements the window must have window = hamming(NWindow); % Window used in the

How does a complex number capture phase, amplitude AND frequency in the result of an FFT?

这一生的挚爱 提交于 2019-12-04 11:09:04
I understand that the magnitude and phase are captured in the real and imaginary parts in the result of an fft. But how does each sample capture phase? Is the phase related to the N discrete samples provided in time domain? That is, if the input sample included 44100 samples for a second, then is each resulting value of the FFT represent 1/44100 of the phase? For example, the first FFT value is at frequency 1/44100 and the second value is 2/44100 and so on? i think you are saying "phase" when you mean "frequency" in some parts of your question? anyway, if you are asking about frequency, it