1
$\begingroup$

I'm wondering how I would go about filtering out a regular sine-wave signal with a constant frequency and voltage.

I'm really new to the whole DSP-area but imagine I would have a regular sinewave at a specific frequency (let's say 30Hz), and on top of that signal I have a bunch of other small peaks (which are the ones I would want to sample and read). What method would I choose?

Here is a visualization of what I meant:

enter image description here

Excuse my terrible Paint-skills but how would I filter out that sinewave, and just keep the small spikes in voltage? What might be worth sharing is that the time between the spikes does have an impact on my measurement of the spikes, or to rephrase: The amount of spikes within x-units of time does have an impact.

Any guidance to the right direction would really be appreciated.

Thank you.

$\endgroup$
2
$\begingroup$

A notch filter is a good approach in general for removing an unwanted frequency. But if you are certain of the exact frequency, phase and amplitude of the unwanted sine wave, then you may also consider adding the noisy signal to a sine wave of the same frequency and amplitude but 180 degrees out of phase with the unwanted sine wave.


To illustrate the notch filter example, the plot below shows an attempt to generate a sine wave with some odd impulses (black), and then filter it with a notch filter knowing the exact frequency (red).

enter image description here

R code for implementing it below.


# 24782
# install.packages('signal')

T <- 1024
t <- 0:(T-1)

fs <- 1000
omega <- 2*pi*30/1000
phi <- 0.9279835

x <- sin(omega*t + phi)

changed <- sample(1:T, 10)

y <- x
y[changed] <- y[changed] + 3

alpha <- 0.9
num <- c(1, -2*cos(omega), 1)
den <- c(1, -2*alpha*cos(omega), alpha*alpha)

yf <- signal::filter(num, den, y)

plot(t,y, type="l", lwd=10)
lines(t,yf, col="red", lwd=4)

legend(850, 4, c("Original", "Filtered"), lwd=c(2.5,2.5),col=c("black","red"))
$\endgroup$
-1
$\begingroup$

You can sample the raw signal and then use a bandstop filter to filter out the 30 Hz frequency component.

http://www.mathworks.com/help/signal/examples/introduction-to-the-filter-design-and-analysis-tool-fdatool.html

Fdatool is a MATLAB tool simply to use

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.