help-octave
[Top][All Lists]

Filter Implementation

 From: shall689 Subject: Filter Implementation Date: Mon, 3 Jul 2017 13:39:39 -0700 (PDT)

Hello,

I have been struggling with trying to implement a low pass filter in excel
using filter coefficients generated from octave (see m file text below). The
coefficients are
b0 = 0.0074833989
b1 = 0.0074833989
a1 = -0.9850332

The excel file is computing the equation:y[n] = b0*x[n] + b1*x[n-1] +
a1*y[n-1]
and filtering the signal: y=2048*sin(2*pi*10000*t)

Excel computes a filtered sinewave having a peak value of 15.6 without any
phase shift.

I expected a sinewave with a peak value of 123 with a -89 phase shift.

Is the above equation correct?  Is there some special I have to do?

Thanks,
Stephen

m file
------
format long
fc = 600;
SampleRate = 250000
fin = 10000;
Tc = 1/(2*pi*fc);
s = tf ('s');
sysC = 1/(1+s*Tc) % continuous transfer functions
sysD = c2d (sysC, 1/SampleRate, 'tustin') % discrete transfer function
[b,a] = tfdata(sysD,'v') % extract the coefficents
InputSignalLengthInSeconds = 10/fin;   % input signal length in seconds
t =linspace(0,InputSignalLengthInSeconds,InputSignalLengthInSeconds*250000);
wt = 2*pi*t*fin;
y=2048*sin(wt);
plot(t,y);
hold on;
y2 = filter(b,a,y);
plot(t,y2);
%print ("FilteredSignal.jpg")
%bode(sysC);

--
View this message in context:
http://octave.1599824.n4.nabble.com/Filter-Implementation-tp4683979.html
Sent from the Octave - General mailing list archive at Nabble.com.

reply via email to