signal-processing

Marking peaks in an ECG signal

雨燕双飞 提交于 2019-12-25 08:03:06
问题 I am working on ECG signal processing. I am using the MIT-BIH Arrhythmia database found here. After loading the signal, I marked the R peaks correctly. Then I was trying to extract QRS complex, but I couldn't. I want to make marks on peaks like in this image: . . . . . . . Here is my code: clear all; clc; close all; load ('G:\1.Thesis\data set\100\100m') %% Remove base & gain %%figure (1) val = (val - 1024)/200; ECGsignal = val(1,1:3600); SAMPLES2READ = 3600; time = (0:length(ECGsignal)-1)

Scale Factor in Matlabs `conv()`

只愿长相守 提交于 2019-12-25 07:33:54
问题 I have the following code which is used to deconvolve a signal. It works very well, within my error limit...as long as I divide my final result by a very large factor (11000). width = 83.66; x = linspace(-400,400,1000); a2 = 1.205e+004 ; al = 1.778e+005 ; b1 = 94.88 ; c1 = 224.3 ; d = 4.077 ; measured = al*exp(-((abs((x-b1)./c1).^d)))+a2; rect = @(x) 0.5*(sign(x+0.5) - sign(x-0.5)); rt = rect(x/83.66); signal = conv(rt,measured,'same'); check = (1/11000)*conv(signal,rt,'same'); Here is what I

Low Pass filter in C

自古美人都是妖i 提交于 2019-12-25 06:59:15
问题 I'm implementing a low pass filter in C wih the PortAudio library. I record my microphone input with a script from PortAudio itself. There I added the following code: float cutoff = 4000.0; float filter(float cutofFreq){ float RC = 1.0/(cutofFreq * 2 * M_PI); float dt = 1.0/SAMPLE_RATE; float alpha = dt/(RC+dt); return alpha; } float filteredArray[numSamples]; filteredArray[0] = data.recordedSamples[0]; for(i=1; i<numSamples; i++){ if(i%SAMPLE_RATE == 0){ cutoff = cutoff - 400; } data

Performing a convolution in matlab

大憨熊 提交于 2019-12-25 04:55:20
问题 Alright, so I am doing some signal processing and I have a signal that is a convolution of a slit of width 83.66 microns and a response function. I want to use the convolution property of fourier transforms to find the response. The code I used is as follows: num=xlsread('Data.xlsx','B2:C13'); y=num(13:end); x=num(1:12); width = 83.66; p = width*sqrt(1/(2*pi))*sinc((x)*(width/2)); slit = abs(fftshift(ifft(p))); figure subplot(5,1,1);plot(x,y);title('imported data') subplot(5,1,2);plot(x,p)

Converting a frequency into a -1..1 float

雨燕双飞 提交于 2019-12-25 03:53:53
问题 I'm trying to play back a sound at a given pitch using (C#) XNA audio framework's SoundEffect class. So far, I have this (very basic) public void playSynth(SoundEffect se, int midiNote) { float pitch = (float)functions.getMIDIFreq(midiNote) / ((float)functions.getMIDIFreq(127)/2); pitch-=1F; Debug.WriteLine("Note: {0}. Float: {1}",midiNote,pitch); synth = se.CreateInstance(); synth.IsLooped = false; synth.Pitch = pitch; synth.Play(); } Currently, the pitch played back is very off-key, because

Speed up MATLAB filter command

北慕城南 提交于 2019-12-25 02:58:16
问题 I am relatively new to using MATLAB filters. I am trying to filter a fairly large data set (about 2 million data points) using the following commands rrc = rcosdesign(0.25, 10, floor(Fs/symRate), 'sqrt'); filtered = filter(rrc, 1, samples); filtered = filtered / sqrt(floor(Fs/symRate)); When I run the MATLAB Profiler, it says the line filtered = filter(rrc, 1, samples); takes over 500 seconds to run. Any ideas on how to speed this up? I have tried using a FilterM function I found online (

Recognize sound based on recorded library of sounds

谁都会走 提交于 2019-12-25 02:57:11
问题 I am trying to create an iOS app that will perform an action when it detects a clapping sound. Things I've tried: 1) My first approach was to simply measure the overall power using an AVAudioRecorder. This worked OK but it could get set off by talking too loud, other noises, etc so I decided to take a different approach. 2) I then implemented some code that uses a FFT to get the frequency and magnitude of the live streaming audio from the microphone. I found that the clap spike generally

PSNR for audio signal in matlab

柔情痞子 提交于 2019-12-25 02:51:15
问题 I am trying to find out the values of MSE and PSNR for audio files in my project. The code i have written so far is as follows: [y1,fs1, nbits1,opts1]=wavread('one.wav'); [y2,fs2, nbits2,opts2]=wavread('newOne.wav'); [c1x,c1y]=size(y1); [c2x,c2y]=size(y1); if c1x ~= c2x disp('dimeonsions do not agree'); else R=c1x; C=c1y; err = (((y1-y2).^2)/(R*C)); MSE=sqrt(err); MAXVAL=65535; PSNR = 20*log10(MAXVAL/MSE); disp(['mse=' num2str(MSE) ' PSNR=' num2str(PSNR)]); end but i am getting error as

PSNR for audio signal in matlab

白昼怎懂夜的黑 提交于 2019-12-25 02:51:03
问题 I am trying to find out the values of MSE and PSNR for audio files in my project. The code i have written so far is as follows: [y1,fs1, nbits1,opts1]=wavread('one.wav'); [y2,fs2, nbits2,opts2]=wavread('newOne.wav'); [c1x,c1y]=size(y1); [c2x,c2y]=size(y1); if c1x ~= c2x disp('dimeonsions do not agree'); else R=c1x; C=c1y; err = (((y1-y2).^2)/(R*C)); MSE=sqrt(err); MAXVAL=65535; PSNR = 20*log10(MAXVAL/MSE); disp(['mse=' num2str(MSE) ' PSNR=' num2str(PSNR)]); end but i am getting error as

How to implement elliptic filters in matlab that passes 8Hz to 35Hz?

送分小仙女□ 提交于 2019-12-25 02:47:27
问题 I have a sampled signal represented as matrix which needs to be filtered to allow only 8-35 Hz. The result also should be a matrix !! 回答1: Use the 'fdatool' to create your filter. Select the Response type Bandpass and the design methode IIR - Elliptic . Now you can fill in your freqency/magnitude specifications and Magnitude check the Magnitude/Phase response. When you are satisfied hit File > Generate Matlab Code and select Data Filtering Function . 来源: https://stackoverflow.com/questions