%Bode Plot from open-loop equation, simple bode() function
% Input in Hz, plot vs. radians/sec.
% Type 1, order 4 (zero and 3 poles in filter)
%   Like Eq. (12.1) in FS by PL but one more pole
% Modify gains, N, and poles and zeros

% MODIFY PARAMETERS AND GO
clear
Kp = 1;
KLF = 1;
Kv = 2e8;
Fp1 = 1;
Fz = 100;
Fp2 = 2000;
Fp3 = 3000;
N = 1000;
%********

twopi = 2*pi;
Wp1 = twopi*Fp1;
Wp2 = twopi*Fp2;
Wp3 = twopi*Fp3;
p = [0;-Wp1;-Wp2;-Wp3]; % pole locations
Wz = twopi*Fz;
z = [-Wz]; % zero location
K = Kp*KLF*Kv*Wp1*Wp2*Wp3/(N*Wz);
[num,den] = zp2tf(z,p,K); % conversion to transfer function

clf; % clear previous graphs; for v.3.5, clg #########
bode(num,den);

