Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Feedback control with integral
- % Input from example 2-4
- sympref('FloatingPointOutput',true)
- clear
- clc
- %% Input:
- A = [0 1; -7 -9] % A matrix
- B = [0; 1] % B matrix
- C = [4 1] % C matrix
- Ts = 0; % Time settling
- Tp = 2; % Time peak
- Os = 0.1; % Overshoot (100%=1.0)
- zero = -4; % Open loop zero
- %% Process:
- syms s k1 k2 k3 ke;
- zeta = -(log(Os)/log(exp(1)))/sqrt(pi^2+(log(Os)/log(exp(1)))^2);
- if(Tp==0) Wn = 4/(zeta*Ts);
- else Wn = pi/(Tp*sqrt(1-zeta^2));
- end
- a11 = A-(B*[k1 k2]);
- a12 = B*ke;
- a21 = -C;
- Anew = [a11 a12; a21 0]
- Ds = expand((s^2 + 2*zeta*Wn*s + Wn^2)*(s-zero))
- 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