Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Chapter 4 example 3
- clear
- clc
- sympref('FloatingPointOutput',true)
- syms s k1 k2 k3 k4 ke;
- %% Input:
- numg = [20 100];
- deng = poly([0 1 4]);
- Ts = 0.74;
- Os = 9.5;
- zeros = s+5;
- %% Process
- G = tf(numg,deng) % Generate transfer function G(s)
- [Ac Bc Cc Dc] = tf2ss(numg,deng);
- P = flip(eye(order(G)));
- A = inv(P)*Ac*P
- B = inv(P)*Bc
- C = Cc*P
- D = Dc
- zeta = (-log(Os/100))/(sqrt(pi^2+log(Os/100)^2));
- Wn = 4/(zeta*Ts);
- %% state-feedback control
- pole1 = s^2 + 2*zeta*Wn*s + Wn^2;
- pole2 = zeros
- Anew = A-(B*[k1 k2 k3])
- Ds = expand(pole1*pole2)
- Ts = det(s*eye(3)-Anew)
- % Solve
- Dsm = coeffs(Ds,s);
- Tsm = coeffs(Ts,s);
- k = vpa(struct2cell((solve(Dsm==Tsm))))
Add Comment
Please, Sign In to add comment