Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc
- clear
- numg = 0.072*conv([1 23],[1 0.05 0.04]); % Define numerator of G(s)
- deng = conv([1 0.08 0.04],poly([0.7 -1.7])); % Define denominator of G(s)
- G = tf(numg,deng) % Generate transfer function G(s)
- %% STEP 1:
- pos = 10;
- Ts = 0.5;
- z = (-log(pos/100))/(sqrt(pi^2+log(pos/100)^2));
- wn = 4/(z*Ts);
- % Produce a second-order system that meets transient response requirements
- [num,den] = ord2(wn,z);
- r = roots(den);
- zeros = roots(numg);
- poles = [r(1) r(2) zeros(2) zeros(3)];
- Ds = poly(poles)
- %% STEP 2:
- % Find controller canonical form of state-space representation
- [Ac Bc Cc Dc] = tf2ss(numg,deng);
- % Find controller canonical form of state-space representation
- P = flip(eye(order(G)));
- % Transform Ac, Bc, Cc and Dc to phase-variable form
- Ap = inv(P)*Ac*P
- Bp = inv(P)*Bc
- Cp = Cc*P
- Dp = Dc
- % Calculate controller gains in phase-variable form.
- Kp = acker(Ap,Bp,poles)
- % Form compensated state-space model
- Apnew = Ap-Bp*Kp;
- Bpnew = Bp;
- Cpnew = Cp;
- Dpnew = Dp;
- % Form transfer function of state-feedback controller
- [numt,dent] = ss2tf(Apnew,Bpnew,Cpnew,Dpnew);
- Tsc = tf(numt,dent)
- % Plot
- step(Tsc);
- title('State Feedback Controller');
- xlim([0 0.6]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement