# I get different results using the step response function only changing the order of the products of some parameters

2 views (last 30 days)
Mattin Muniain on 12 Oct 2017
Edited: Mattin Muniain on 12 Oct 2017
Hello everybody,
This is quite a simple code: I define some parameters (resistances, inductances) and after I analyse the dynamic responses. There, to obtain the kp and ki values of the PI controller, I define wn. As you can see in the code, I define two, only altering the order of the multiplications: wn = x*R/L; WN = R/L*x; The result I obtain with each one are different in the step response, as you can see in the image or compiling the code:
if true
%%Code starts here
clear all
close all
clc
%%Parameters
Rs = 1.405; % Stator resistance (Ohm)
Lls = 0.005839; % Stator Leakage inductance (H)
Llr = Lls; % Rotor Leakage inductance (H)
Rr = 1.395; % Rotor resistance (Ohm)
Lm = 0.1722; % Mutual inductance (H)
Ls = Lm + Lls; % Stator inductance
Lr = Lm + Llr; % Rotor inductance
R = Rs + Rr*(Lm^2)/(Lr^2);
sigma = 1 - Lm^2/Lr/Ls;
L = sigma*Ls;
%%Dynamics
s = tf([1 0],);
x = 5; % "x" times faster dynamics (%xi = 1)
wn = x*R/L;
WN = R/L*x;
kp = 2*wn*L-R;
KP = 2*WN*L-R;
ki = wn^2*L;
KI = WN^2*L;
Ids_cl=(kp*s + ki)/L/(s^2 + (R + kp)/L*s + ki/L);
Ids_CL=(KP*s + KI)/L/(s^2 + (R + KP)/L*s + KI/L);
%%Graphs
figure()
step(Ids_cl)
hold on
step(Ids_CL)
grid on
end

Mischa Kim on 12 Oct 2017
Edited: Mischa Kim on 12 Oct 2017
Hi Mattin, welcome to the world of numerical analysis. While
wn = x*R/L;
WN = R/L*x;
are the same expressions symbolically, they are not numerically. In fact
wn - WN
ans = 2.273736754432321e-13
and, therefore
ki - KI
ans = 9.094947017729282e-12
As a result, one system is underdamped ( Ids_cl ), the other is not. In the pole zero map below you can see the Ids_cl is just "barely" underdamped, note the scale on the y-axis. #### 1 Comment

Mattin Muniain on 12 Oct 2017
Thank you Mischa,but I am still surprised how that small difference in the values of ki can have so much infuence on the dynamic response of the system.