From: Robert Longnecker on
Ok, first i would like to thank any one who post a response.

I am working with accelerometer data. The DC offset is set around 2.5 volts and the max and min outputs are 4.5 and 0.5 respectively.

The problem i am having is that the signal has a sinusoidal noise that affects the signal such that the output itself looks like a sinusoid.

I felt that i could get rid of the higher frequency by using butter and filter like this

[B,A] = butter(9,450/500)
filtered = filter(B,A,jm.accData.Y1)

But the filtered data is just blank; am I missing something?
I have changed the order of the filter to no avail.
I am sampling at 1000 Hz. I have also tried changing to an analog butter using butter(9,500,'s'), but that did not work either.
From: Wayne King on
"Robert Longnecker" <rlongnec(a)hsc.unt.edu> wrote in message <htm5um$aro$1(a)fred.mathworks.com>...
> Ok, first i would like to thank any one who post a response.
>
> I am working with accelerometer data. The DC offset is set around 2.5 volts and the max and min outputs are 4.5 and 0.5 respectively.
>
> The problem i am having is that the signal has a sinusoidal noise that affects the signal such that the output itself looks like a sinusoid.
>
> I felt that i could get rid of the higher frequency by using butter and filter like this
>
> [B,A] = butter(9,450/500)
> filtered = filter(B,A,jm.accData.Y1)
>
> But the filtered data is just blank; am I missing something?
> I have changed the order of the filter to no avail.
> I am sampling at 1000 Hz. I have also tried changing to an analog butter using butter(9,500,'s'), but that did not work either.

Hi Robert, I guess I would start by asking you if you have correctly identified the frequency you want to remove. Did you first do a spectral analysis? Something like:

Fs = 1e3;
t = 0:1/Fs:1;
x = 2.5+cos(2*pi*300*t)+randn(size(t));
Hspec = spectrum.periodogram('Hamming');
plot(psd(Hspec,x,'Fs',1e3))

Obviously insert your data for x in the plot( ) command. I'm assuming you have some kind of nested struct array by your syntax: jm.accData.Y1 You should verify that jm.accData.Y1 contains what you think it does, i.e. the data vector you want to filter.

Then, try using a filter object. I'll assume that the oscillation is at 450 Hz, but make the appropriate adjustments if it is not.

hlowpass = fdesign.lowpass('Fp,Fst,Ap,Ast',400,425,0.5,60,1000);
FiltObj = design(hlowpass);
OutputData = filter(FiltObj,InputData);


Wayne