I haven’t defined syms x but solve function gives me values depend on x
I am designing a PID controller for which I set the denominator of my closed-loop transfer function equal to the product of the dominant poles and the residue polynomial.
My goal is to get values that depend on Ki, but even though I don’t use the syms x command, my values depend on x and Ki.
clear all;
clc;
syms zeta positive
syms s;
syms Kp Ki Kd;
% Given values
ts = 4; % Settling time
Mp = 0.05; % Maximum overshoot
% Define the overshoot equation
eq1 = exp(-zeta*pi / sqrt(1 – zeta^2)) == Mp;
% Solve for zeta numerically (only real positive solution makes sense)
zeta = double(vpasolve(eq1, zeta, [0 1]));
% Now calculate omega_n using Ts = 4 / (zeta * omega_n)
w_n = 4 / (zeta * ts);
G= (s+1)/(s^3 +6*s^2 +10*s -15)
H= 10/(s+10)
F= (Kd*s^2 + Kp*s + Ki)/s
Tcl= (F*G)/(1 + F*G*H)
[num, den] = numden(simplifyFraction(Tcl));
num = expand(num)
den = expand(den)
num_s = coeffs(num, s, ‘All’)
den_s = coeffs(den, s, ‘All’)
Pd=s^2 +2*zeta*w_n*s+(w_n)^2
syms e0 e1 e2 positive;
Pr= (s+e0)*(s+e1)*(s+e2)
Pe=expand(Pd*Pr)
Pe_s= coeffs(Pe,s,"All")
eq2 = Pe_s == den_s
sol2 = solve(eq2, [Kp, Kd, e0, e1, e2], ‘Real’, true);
% den_s=subs(den_s,[Kd,Kp],[sol2.Kd,sol2.Kp])
% F = subs(F,[Kd,Kp],[sol2.Kd,sol2.Kp])I am designing a PID controller for which I set the denominator of my closed-loop transfer function equal to the product of the dominant poles and the residue polynomial.
My goal is to get values that depend on Ki, but even though I don’t use the syms x command, my values depend on x and Ki.
clear all;
clc;
syms zeta positive
syms s;
syms Kp Ki Kd;
% Given values
ts = 4; % Settling time
Mp = 0.05; % Maximum overshoot
% Define the overshoot equation
eq1 = exp(-zeta*pi / sqrt(1 – zeta^2)) == Mp;
% Solve for zeta numerically (only real positive solution makes sense)
zeta = double(vpasolve(eq1, zeta, [0 1]));
% Now calculate omega_n using Ts = 4 / (zeta * omega_n)
w_n = 4 / (zeta * ts);
G= (s+1)/(s^3 +6*s^2 +10*s -15)
H= 10/(s+10)
F= (Kd*s^2 + Kp*s + Ki)/s
Tcl= (F*G)/(1 + F*G*H)
[num, den] = numden(simplifyFraction(Tcl));
num = expand(num)
den = expand(den)
num_s = coeffs(num, s, ‘All’)
den_s = coeffs(den, s, ‘All’)
Pd=s^2 +2*zeta*w_n*s+(w_n)^2
syms e0 e1 e2 positive;
Pr= (s+e0)*(s+e1)*(s+e2)
Pe=expand(Pd*Pr)
Pe_s= coeffs(Pe,s,"All")
eq2 = Pe_s == den_s
sol2 = solve(eq2, [Kp, Kd, e0, e1, e2], ‘Real’, true);
% den_s=subs(den_s,[Kd,Kp],[sol2.Kd,sol2.Kp])
% F = subs(F,[Kd,Kp],[sol2.Kd,sol2.Kp]) I am designing a PID controller for which I set the denominator of my closed-loop transfer function equal to the product of the dominant poles and the residue polynomial.
My goal is to get values that depend on Ki, but even though I don’t use the syms x command, my values depend on x and Ki.
clear all;
clc;
syms zeta positive
syms s;
syms Kp Ki Kd;
% Given values
ts = 4; % Settling time
Mp = 0.05; % Maximum overshoot
% Define the overshoot equation
eq1 = exp(-zeta*pi / sqrt(1 – zeta^2)) == Mp;
% Solve for zeta numerically (only real positive solution makes sense)
zeta = double(vpasolve(eq1, zeta, [0 1]));
% Now calculate omega_n using Ts = 4 / (zeta * omega_n)
w_n = 4 / (zeta * ts);
G= (s+1)/(s^3 +6*s^2 +10*s -15)
H= 10/(s+10)
F= (Kd*s^2 + Kp*s + Ki)/s
Tcl= (F*G)/(1 + F*G*H)
[num, den] = numden(simplifyFraction(Tcl));
num = expand(num)
den = expand(den)
num_s = coeffs(num, s, ‘All’)
den_s = coeffs(den, s, ‘All’)
Pd=s^2 +2*zeta*w_n*s+(w_n)^2
syms e0 e1 e2 positive;
Pr= (s+e0)*(s+e1)*(s+e2)
Pe=expand(Pd*Pr)
Pe_s= coeffs(Pe,s,"All")
eq2 = Pe_s == den_s
sol2 = solve(eq2, [Kp, Kd, e0, e1, e2], ‘Real’, true);
% den_s=subs(den_s,[Kd,Kp],[sol2.Kd,sol2.Kp])
% F = subs(F,[Kd,Kp],[sol2.Kd,sol2.Kp]) solve MATLAB Answers — New Questions