%EE212 Lab 6 Op-Amp plot


Rf=1E5;  % set feedback resistor to 10 kOhm
%
Ri=1E3;   %set input resistor to 1 kOhm
%
Cf=1E-7;   %set feedback resistor to 0.1 microFarad
%
Ci=1E-7;   %set input resistor to 0.1 microFarad
%
f=logspace(-1,5,600); % define 600 equally spaced frequency
%steps from 0.1 to 1E5
%
%
Zf=(Rf./(2*pi*f*Cf*j))./(Rf+1./(2*pi*f*Cf*j));
Zi=(1./(j*2*pi*f*Ci))+Ri;
%For Vin = 1
Vout=-(Zf./Zi);
%
%              The ./ operator divides the two functions for 
%              each value of f.
%
semilogx(f,unwrap((180/pi)*angle(Vout)))  %Angle of Vout is plotted versus
%f  on semilog scale
%
% The following comands make the plot much more meaningful!
%
title('Op-Amp band pass filter')
grid
xlabel('frequency in Hertz')
ylabel('Transfer function angle')
%
%
orient landscape
%print   % Remove the "% sign" before print statement if you want to plot
%the above functions


