Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to apply filter on input signal x after designing from fdesign.notch?

277 views
Skip to first unread message

Harsh

unread,
Jan 5, 2011, 2:32:06 PM1/5/11
to
I have design the notch filter using fdesign.notch in MATLAB.
I can also see the response with fvtool.
But I cannot find any way to apply this filter on the actual signal x that is already stored as array. How to do that?
Plzz help me.

Wayne King

unread,
Jan 8, 2011, 10:52:05 AM1/8/11
to
"Harsh " <hars...@yahoo.com> wrote in message <ig2gvm$aeq$1...@fred.mathworks.com>...

Hi Harsh,

You use the filter() method with your designed filter and your input. For example:

Design a filter with a notch at 60 Hz for data sampled at 1 kHz.

fspec = fdesign.notch('N,F0,Q,Ap',6,60,30,0.5,1000);
% design filter
d = design(fspec);
% create some data to notch filter
t = linspace(0,1,1e3);
x = cos(2*pi*60*t)+randn(size(t));
% filter the data
y = filter(d,x);
% plot the PSD of the notch filtered data
plot(psd(spectrum.periodogram,y,'Fs',1e3));

Hope that helps,
Wayne

0 new messages