function [t,y,z]=bw(alpha,omega) 
% BW illustrates the Butterworth filter. We simulate it by solving
% the ODE y'+ y/alpha = f(t)/alpha, where
% 
% f(t) = exp(-t/2).*(sin(t)+sin(omega*t)/10).
% 
% If no outputs are specified, then plots of y(t) and f(t) are
% generated.
%
% Francis J. Narcowich -- Feb. 13, 2003 

[t,y]=ode23(@y_dot,[0,20],0,[],alpha,omega);
z=target_funtion(t,omega);

if nargout == 0, 
  subplot(2,1,1), plot(t,z,t,y,'r')
  subplot(2,1,2), plot(t,y,'r')
end


function ydot=y_dot(t,y,alpha,omega)
ydot = -alpha*y+alpha*exp(-t/2).*(sin(t)+sin(omega*t)/10);

function z=target_funtion(t,omega)
z=exp(-t/2).*(sin(t)+sin(omega*t)/10);







