
From:  Doug Stewart 
Subject:  Re: Filter Implementation 
Date:  Mon, 3 Jul 2017 19:09:33 0400 
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[n1] +
a1*y[n1]
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

pkg load control
pkg load signal
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);
[Prev in Thread]  Current Thread  [Next in Thread] 